-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support hidden posts #2866
Support hidden posts #2866
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Left some minor comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@avaris Updated the documentation so the file is outdated now but let me know which way you want to go on the wording.
I think "output" is technically acceptable here, but we can definitely change it to "outputted" for consistency. Up to you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for implementing this!
This is cool; this is a feature I would see myself making use of. Out of curiosity, what happens to a category page if all the entries in it are hidden? Would the category still be listed on the "Categories" page? And the same question for labels, authors, archives, and period archive pages. Also, when working on a theme/in the templating engine, is there a (easy) way to get a list of all articles, including the hidden ones? (something like
For reference, this is the current code that I'm using to generate links to the period archive pages (with similar loops for monthly and daily links): https://github.com/MinchinWeb/seafoam/blob/archive-periods/seafoam/templates/period_archives.html#L71..L147 {# Top Row with links to Archives by Year #}
<div class="archives-quicklinks text-center col-xs-12">
{% for article in dates %}
{% if loop.index0 == 0 or (article.date.year != dates[loop.index0 - 1].date.year) %}
{% if loop.index0 != 0 %} • {% endif -%}
{%- if article.date.year == period[0] and period | length == 1 -%}
<span class="active">{{ article.date.year }}</span>
{%- else -%}
<a href=
{%- if YEAR_ARCHIVE_URL -%}
"{{ SITEURL -}} /
{{- article.date | merge_date_url (YEAR_ARCHIVE_URL) }}"
{%- else -%}
"{{ SITEURL -}} / {{- ARCHIVES_URL | default('archives.html') -}}
#{{ article.date.year }}"
{%- endif -%}
>
{{- article.date.year -}}
</a>
{%- endif -%}
{%- endif -%}
{%- endfor %}
</div> The above relies on Thanks for your help! |
The behavior here would be the the same as with draft posts: drafts and hidden posts are not automatically added to those indexes, so if the only posts that use a category/tag/author is a draft (or hidden), that category index page wouldn't be generated.
There's not a built-in variable for "published articles and drafts by date" or "published articles and hidden articles by date", but it should be fairly easy to write the equivalent in pure jinja. If this is something your site does regularly it should be fairly easy for the user to write an extra list like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made two minor reST-formatting suggestions. Other than that, I think this ready to go! 💫
@@ -614,6 +614,14 @@ the ``DEFAULT_METADATA``:: | |||
To publish a post when the default status is ``draft``, update the post's | |||
metadata to include ``Status: published``. | |||
|
|||
Hidden posts | |||
================= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps shorten this header underline to match the length of the header text above it?
================= | ||
|
||
Like pages, posts can also be marked as ``hidden`` with the ``Status: hidden`` | ||
attribute. Hidden posts will be output to `ARTICLE_SAVE_AS` as expected, but |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`ARTICLE_SAVE_AS` → ``ARTICLE_SAVE_AS``
Is there currently a way to generate these index pages? I suppose these pages (by default) would be empty, but in theory, they would also be hidden. In any case, this (generating these index pages) isn't something I think I can do from Jinja. (If that's not something you want to tackle, that's fine, but any tips on how to implement it myself would be appreciated.)
A built in variable was what I was hoping for. I could probably put something together as a Jinja Filter if it came to that. The inline entry in Thanks for your explanation. |
Manually merged via add3628. Will issue a release soon containing this new feature. Many thanks to @GiovanH for the enhancement and to @oulenz, @avaris, and @MinchinWeb for reviewing. 🥇 |
Pull Request Checklist
Resolves: #1965
This adds
hidden_articles
andhidden_translations
to the article generator, as described in #1965 and #2865. There are some very basic test cases, including test cases for drafts.