mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Hidden articles implementation
This commit is contained in:
parent
fac43df2da
commit
955fddf744
3 changed files with 19 additions and 8 deletions
|
|
@ -137,6 +137,11 @@ class Pelican:
|
|||
len(articles_generator.drafts_translations)),
|
||||
'draft',
|
||||
'drafts')
|
||||
pluralized_hidden_articles = maybe_pluralize(
|
||||
(len(articles_generator.hidden_articles) +
|
||||
len(articles_generator.hidden_translations)),
|
||||
'hidden article',
|
||||
'hidden articles')
|
||||
pluralized_pages = maybe_pluralize(
|
||||
(len(pages_generator.pages) +
|
||||
len(pages_generator.translations)),
|
||||
|
|
@ -153,10 +158,11 @@ class Pelican:
|
|||
'draft page',
|
||||
'draft pages')
|
||||
|
||||
print('Done: Processed {}, {}, {}, {} and {} in {:.2f} seconds.'
|
||||
print('Done: Processed {}, {}, {}, {}, {} and {} in {:.2f} seconds.'
|
||||
.format(
|
||||
pluralized_articles,
|
||||
pluralized_drafts,
|
||||
pluralized_hidden_articles,
|
||||
pluralized_pages,
|
||||
pluralized_hidden_pages,
|
||||
pluralized_draft_pages,
|
||||
|
|
|
|||
|
|
@ -180,9 +180,9 @@ class Content:
|
|||
if hasattr(self, 'allowed_statuses'):
|
||||
if self.status not in self.allowed_statuses:
|
||||
logger.error(
|
||||
"Unknown status '%s' for file %s, skipping it.",
|
||||
"Unknown status '%s' for file %s, skipping it. (Not in %s)",
|
||||
self.status,
|
||||
self
|
||||
self, self.allowed_statuses
|
||||
)
|
||||
return False
|
||||
|
||||
|
|
@ -495,7 +495,7 @@ class Page(Content):
|
|||
|
||||
class Article(Content):
|
||||
mandatory_properties = ('title', 'date', 'category')
|
||||
allowed_statuses = ('published', 'draft')
|
||||
allowed_statuses = ('published', 'hidden', 'draft')
|
||||
default_status = 'published'
|
||||
default_template = 'article'
|
||||
|
||||
|
|
|
|||
|
|
@ -648,6 +648,7 @@ class ArticlesGenerator(CachingGenerator):
|
|||
all_drafts.append(article)
|
||||
elif article.status == "hidden":
|
||||
hidden_articles.append(article)
|
||||
|
||||
self.add_source_path(article)
|
||||
self.add_static_links(article)
|
||||
|
||||
|
|
@ -665,7 +666,7 @@ class ArticlesGenerator(CachingGenerator):
|
|||
|
||||
for article in self.articles:
|
||||
# only main articles are listed in categories and tags
|
||||
# not translations
|
||||
# not translations or hidden articles
|
||||
self.categories[article.category].append(article)
|
||||
if hasattr(article, 'tags'):
|
||||
for tag in article.tags:
|
||||
|
|
@ -687,8 +688,10 @@ class ArticlesGenerator(CachingGenerator):
|
|||
self.authors = list(self.authors.items())
|
||||
self.authors.sort()
|
||||
|
||||
self._update_context(('articles', 'dates', 'tags', 'categories',
|
||||
'authors', 'related_posts', 'drafts'))
|
||||
self._update_context((
|
||||
'articles', 'drafts', 'hidden_articles',
|
||||
'dates', 'tags', 'categories',
|
||||
'authors', 'related_posts'))
|
||||
self.save_cache()
|
||||
self.readers.save_cache()
|
||||
signals.article_generator_finalized.send(self)
|
||||
|
|
@ -702,7 +705,9 @@ class ArticlesGenerator(CachingGenerator):
|
|||
for e in chain(self.articles,
|
||||
self.translations,
|
||||
self.drafts,
|
||||
self.drafts_translations):
|
||||
self.drafts_translations,
|
||||
self.hidden_articles,
|
||||
self.hidden_translations):
|
||||
if hasattr(e, 'refresh_metadata_intersite_links'):
|
||||
e.refresh_metadata_intersite_links()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue