Since I am also new to pelican, consult with salt.
This variable will give you the name of the current file, as indicated in the documentation :
{{ output_file }}
For example: when creating menu items for my pages, I can check the "save_as" property on the page to highlight the exact corresponding menu item:
{% if output_file == p.save_as %}active{% endif %}
But in your case, it should be, for example, enough to check that the current page is an article in general (assuming that the "Blog" contains all of your articles) to highlight the blog menu item. For example, checking if the variable "article" exists:
{% if article %}class="active"{% endif %}
If your projects are made up of βpages,β just check them for the primary variable of this content type:
{% if page %}class="active"{% endif %}
For homepage, categories, archives, etc. you can check the contents of "page_name":
{% if page_name == 'index' %}class="active"{% endif %}
source share