Page URLs not working

octobercms

624 просмотра

3 ответа

101 Репутация автора

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" href="{{ 'news'|page }}">Novità</a></li>

and

<li><a title="Le novità del nostro negozio" 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!

Автор: abarts_original Источник Размещён: 18.07.2016 08:33

Ответы (3)


3 плюса

2420 Репутация автора

Решение

You can use the URL helper function. For example:

<a href="{{ url('/news') }}">News</a>

This should produce something like:

<a href="http://app.localhost/news">News</a>
Автор: Alexandre Thebaldi Размещён: 18.07.2016 05:46

0 плюса

81 Репутация автора

The |page filter creates a link to a page using a page file name

Save your page in news.htm file, and try

href="{{ 'news'|page }}"

or save in something.htm file, and try

href="{{ 'something'|page }}"

OctoberCMS filer |page

Автор: Tomasz P Размещён: 23.10.2016 03:22

0 плюса

438 Репутация автора

Like Tomasz P stated

October CMS using the |page filter is actually looking for the file name. Which is good to use if you decide to change the url and keep the page the same name.

Photo of the CMS Page Settings

So in this case I need to use site/store. Because your link is routing to the home page or doing nothing is probably because it can't find the correct file name.

<a href="{{ 'site/store'|page }}">Store</a>

I usually stick with standard link usage 
<a href="/store">Store</a>
Автор: Pettis Brandon Размещён: 31.07.2018 07:10
Вопросы из категории :
32x32