Page.active Not True?

I’m having trouble getting navigation links to get class="active" applied when I think it should be.

My blog page is at “home”, www.grav.dev in my case. When I’m on www.grav.dev my blog menu item doesn’t get the active class applied.

In my system.yaml I have

home:
  alias: '/blog'

And in blog.md I have

title: Blog
blog_url: blog

What have I missed?

I’m using the check logic from the antimatter theme:

{% set current_page = (page.active or page.activeChild) ? 'active' : '' %}
<li class="{{ current_page }}">
   <a href="{{ page.url }}">{{ page.menu|title }}</a>
</li>

Sorry removed my reply. I debugged this and had no problems. I think this could be your cache issue again. While working in development you might just want to turn caching off.

Try clearing cache and see if that fixes it for you.

OK, it’s working. And it seems as if it was a caching problem somewhere. I disabled Grav’s caching for my development environment like this:

cache:
  enabled: false
  
twig:
  cache: false

And I cleared the caches, both Grav’s and CodeKit’s. I’m working to find out if and how I can disable CodeKit’s caching. I like CodeKit and use it to handle SASS (compiling to the folders I want) as well as Bourbon and Neat. I know there are other ways, but…

Let’s see if that keeps working.

Thanks!

CodeKit is great, but it’s totally overkill for Grav. I can walk you through doing it without CodeKit in about 2 mins. Hop on IRC today and we can do that. That will ease your burdens :slight_smile:

I could get it going with Grunt and LiveReload. But are you thinking of something else?

Not even that complicated. You can just install sass for the command line (http://sass-lang.com/install). One liner on mac, and pretty easy even on windows. Then you can just watch and automatically compile with a single line in your console/terminal:

scss --watch scss:css-compiled

We even have a script (.scss.sh) in the antimatter folder so you don’t even need to remember this.

You don’t really need any kind of live reload as Grav is so fast anyway, but you can even use a simple JS based reload like CSS Refresh to automatically reload your browser when it detects a change to the compiled CSS file.

This is all I ever use.

I know, I know. :slight_smile:

But CodeKit offers so many creature comforts:

It’s server refreshes pages automatically for all devices and browsers on the page so you can see what changes look like in many situations at one.

It manages updates to SCSS, Bourbon, Neat, etc. within itself.

It post processes with autoprefixer.

It’s nice graphical interface let’s you manage language options. So I have Sass compiled with my settings into my folder structure.

It’s release notes are entertaining to read! :slight_smile: