This repository has been archived by the owner on Aug 6, 2024. It is now read-only.
forked from mozilla-services/servicedenuages.fr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pelican actually handle tags a bit differently.
The previous version was working but not in all situations, and especially it wasn't able to generate the tag feeds.
- Loading branch information
Showing
2 changed files
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
from pelican import signals | ||
from pelican.contents import Tag | ||
|
||
def add_category(generator): | ||
tag = Tag('mozilla', generator.settings) | ||
for article in generator.articles: | ||
if hasattr(article, 'tags'): | ||
article.tags.append('mozilla') | ||
else: | ||
setattr(article, 'tags', ['mozilla']) | ||
if not hasattr(article, 'tags'): | ||
setattr(article, 'tags', [tag,]) | ||
|
||
def register(): | ||
signals.article_generator_finalized.connect(add_category) | ||
signals.article_generator_pretaxonomy.connect(add_category) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters