Active Page If page:1?

% set current_page = (p.active or p.activeChild) ? 'active' : '' %} does not set the current_page to active if the page is of the form blog/page:1

The Antimatter theme has this problem, too, but not the main Grav blog.

Does Grav have a test for that case, or should I construct something myself?

i can confirm this is a bug if the page with pagination is the home page. I will look into it.

Ok, there is a simple fix for this. Edit your /user/config/site.yaml and add this:

blog:
  route: '' 

As there is no blog.route set, it’s default to /blog as provided in the system/config/site.yaml and that is why it’s adding the /blog in the URL and losing the active state in the menu.

That works.

I was hoping this would also fix the problem where blog posts are not seen as children to the main blog page, so the blog menu items doesn’t get the active class. My blog post URLs look like this: /blog/what-if-photos-is-great.

Is the /blog/ part still to blame?

Yep, I cleared my caches. :slight_smile:

Yah, those base_url value (current version of Antimatter) is built with site.blog.route. And that is defaulting to /blog in the system/config/site.yaml.

My fix was to override and set this value in your /user/config/site.yaml. I tested this and it worked.

I’ve actually changed Anitmatter for the next release so that this value will no longer be used. It will set base_url to page.url in blog.html.twig and set it to page.parent.url in item.html.twig. This will ensure you won’t need that site.blog.route to be provided going forward.

So to summarize, my fix does work, you may of just changed the wrong file, or changed it incorrectly. By changing the config file, it should automatically update the cache.

Actually spoke to soon… Works fine on homepage, but not on an ‘item’ page. Will look at that again.

Ok proper fix will be in 0.9.5 release (tonight?) if i can get my house chores done! :slight_smile:

Released!