Page URLs not working

- 1 answer

Ad

I'm new with October and I'm trying to develope some themes and plugins.

It's all working fine except of page links.

For example, Blog page has this markup:

title = "Novità & Offerte"
url = "/news"
layout = "blog"
is_hidden = 0
meta_title = "News & Offerte"
meta_description = "Scopri tutte le novità."

[blogPosts]
pageNumber = "{{ :page }}"
postsPerPage = 10
noPostsMessage = "No posts found"
sortOrder = "published_at desc"
categoryPage = "news/categorie"
postPage = "news/post"
==
{% component 'blogPosts' %}

I tried to call this page from a static menu on the header partial, with no results: it keeps redirecting to the home page.

Tried:

<li><a title="Le novità del nostro negozio" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ 'news'|page }}">Novità</a></li>

and

<li><a title="Le novità del nostro negozio" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ '/news'|page }}">Novità</a></li>

Nothing works. I can't figure out why it redirects correctly to blog posts or categories and not to "normal" pages of October.

The blog is running with Rainlab Blog plugin.

Can someone help me with this?

Thanks in advance!

Ad

Answer

Ad

You can use the URL helper function. For example:

<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ url('/news') }}">News</a>

This should produce something like:

<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="http://app.localhost/news">News</a>
Ad
source: stackoverflow.com
Ad