Pelican-Elegant / elegant

Best theme for Pelican Static Blog Generator
https://elegant.oncrashreboot.com/
MIT License
293 stars 187 forks source link

Links in top menu bar are not working #328

Closed talha131 closed 5 years ago

talha131 commented 5 years ago

Categories, archives, and tags menu items, they all point to the home page.

I suspect its due to this commit https://github.com/Pelican-Elegant/elegant/pull/186/

AWegnerGitHub commented 5 years ago

It looks like this might be another Pelican 4.0 thing.

From the settings documentation (search "Direct Templates")

DIRECT_TEMPLATES work a bit differently than noted above. Only the _SAVE_AS settings are available, but it is available for any direct template.

Example: ARCHIVES_SAVE_AS = 'archives.html'


This is a bit confusing though as another section on the same page says this:

URLs for direct template pages are theme-dependent. Some themes use corresponding *_URL setting as string, while others hard-code them: 'archives.html', 'authors.html', 'categories.html', 'tags.html'.

I've asked for clarification in https://github.com/getpelican/pelican/issues/2490

talha131 commented 5 years ago

Thank @AWegnerGitHub. I have assigned the issue to you.

Please also see this issue

https://github.com/Pelican-Elegant/elegant/issues/203

iranzo commented 5 years ago

Theoretically the defaults should be valid (pelican defaults), thing is that we shouldn't hardcode them or reference to hardcode them.

iranzo commented 5 years ago

So probably yes, 4.x issue let's see what we do get on the issue you raised!

AWegnerGitHub commented 5 years ago

pelican itself doesn't use or generate *_URL variables for direct templates.

https://github.com/getpelican/pelican/issues/2490#issuecomment-446666400

So, either we define the *_URL values in the config file, or we need to utilize another option? The comment linked above gives an example. Would this be a good idea for us?

iranzo commented 5 years ago

+1 on defining them in our 'elegant setup guide'

talha131 commented 5 years ago

We should strive for making Elegant work for the user out of the box. We already have too many options to configure. We should,

  1. Provide reasonable defaults such that site can be up and running without any configuration
  2. May provide variables to fine tune the site

The example here is pretty good.

<a href='{{ SITEURL }}/{{ ARCHIVES_URL or 'archives' }}'>Link to archives</a>

I think it covers both the points.

@AWegnerGitHub, if @iranzo does not disagree or bring up a counter point, please open up a PR in elegant repo with the fixes.


I did a quick test locally and it worked

<li {% if page_name == 'categories' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ CATEGORIES_URL or 'categories' }}">Categories</a></li>
<li {% if page_name == 'tags' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ TAGS_URL or 'tags' }}">Tags</a></li>
<li {% if page_name == 'archives' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ ARCHIVES_URL or 'archives'}}">Archives</a></li>
iranzo commented 5 years ago

Validated in live website after elegant merge that triggered documentation rebuild

talha131 commented 5 years ago

Thank you @iranzo for testing it for me.