molivier / nest

Nest Pelican Template
https://www.molivier.com
GNU General Public License v2.0
123 stars 50 forks source link

For pelican 4, tags and categories |format must be updated to 'slug=' #21

Open iranzo opened 5 years ago

iranzo commented 5 years ago

Hi, With Pelican 4, templates/base will traceback because new format requires:

format(slug=$PREVIOUSTEXT) for both categories and tags rss/atom feed

Regards, Pablo

iranzo commented 5 years ago
{% if CATEGORY_FEED_ATOM and category %}
        <link href="{{ FEED_DOMAIN }}/{{ CATEGORY_FEED_ATOM|format(slug=category.slug) }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Categories Atom Feed" />
        {% endif %}
        {% if CATEGORY_FEED_RSS and category %}
        <link href="{{ FEED_DOMAIN }}/{{ CATEGORY_FEED_RSS|format(slug=category.slug) }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Categories RSS Feed" />
        {% endif %}
        {% if TAG_FEED_ATOM and tag %}
        <link href="{{ FEED_DOMAIN }}/{{ TAG_FEED_ATOM|format(slug=tag.slug) }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Tags Atom Feed" />
        {% endif %}
        {% if TAG_FEED_RSS and tag %}
        <link href="{{ FEED_DOMAIN }}/{{ TAG_FEED_RSS|format(slug=tag.slug) }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Tags RSS Feed" />
        {% endif %}
romunov commented 5 years ago

The release notes state that

For example, substitute TAG_FEED_ATOM|format(tag.slug) with TAG_FEED_ATOM.format(slug=tag.slug).

That being said, this does not work for me. I get CRITICAL: UndefinedError: 'tag' is undefined error.

iranzo commented 5 years ago

I'm using pelican 4 and it renders properly:

themes/nest/templates/base.html:        {% if TAG_FEED_ATOM and tag %}
themes/nest/templates/base.html:        <link href="{{ FEED_DOMAIN }}/{{ TAG_FEED_ATOM|format(slug=tag.slug) }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Tags Atom Feed" />
themes/nest/templates/base.html:        {% if TAG_FEED_RSS and tag %}
themes/nest/templates/base.html:        <link href="{{ FEED_DOMAIN }}/{{ TAG_FEED_RSS|format(slug=tag.slug) }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Tags RSS Feed" />
romunov commented 5 years ago

No doubt I'm doing something wrong. I'll try your approach.