Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Page.url routes to base.url?

Started by Muut Archive 11 years ago · 2 replies · 290 views
11 years ago

This one is really making me scratch my head. I thought I was done, and now when I click on a post title on the main page, it takes me to the base url template, not the page template. I'm really at a loss as to what I changed. Switching themes back to Antimatter makes it work correctly, but I can't find the mistake. Any ideas?

11 years ago

What does the HTML look like for the link in the Bootstrap Twig template? Will probably be something like:

TWIG
<h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
11 years ago

In my option, i save base_url variable into theme, example:

PHP
$this->grav['twig']->twig_vars['base_url'] = $this->grav['page']->find($this->grav['config']->get('system.home.alias'))->url(true);

If you want save into theme directly you can use this:

TWIG

{% set base_url = page.find(config.system.home.alias).url(true) %}
---

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1318 9 years ago
Archive · by Muut Archive, 9 years ago
2 915 9 years ago
Archive · by Muut Archive, 9 years ago
2 4044 9 years ago
Archive · by Muut Archive, 9 years ago
1 2920 9 years ago
Archive · by Muut Archive, 9 years ago
3 1104 9 years ago