-
Notifications
You must be signed in to change notification settings - Fork 291
Feature: Introductory text for autopages, etc. #75
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
base: master
Are you sure you want to change the base?
Conversation
I don't know about this feature. It honestly seems out of scope for this plugin. I would like to investigate ways to support this in a more Jekyll native way before adding this feature to the gem. The next thing that will be asked for it a text after the pagination. Feels like this should rather be handled by the layout template somehow (just not sure yet how to do it) |
Well, I did start on it because you said in #58 :
Your decision, of course. I'm fine either way. :-) |
eeps, this is my bad, I really didn't think this through... I'm sorry to yoyo like this :/ |
For what it's worth I do something similar with pure Liquid and a Jekyll data file to add introductory text to various tag pages generated with the Autopage module. In the data file I add a set of key/value pairs with descriptive text. # _data/taxonomy.yml
tag1:
description: "This describes tag 1."
tag2:
description: "This describes **tag 2**." Then in my layout I use something like this to pull in the text (if available). If not it fallsback to some default text. {% assign taxonomy = page.autopages.display_name | downcase | slugify %}
{% assign tag = site.data.taxonomy[taxonomy] %}
{% if tag.description %}
{{ tag.description | markdownify }}
{% else %}
<p>An archive of posts tagged <em>{{ page.autopages.display_name }}</em>.</p>
{% endif %} |
@mmistakes I also do something similar, for plaintext introductions. This patch still has some value if one needs Liquid and Markdown in the intro text. |
This implements an "intro" feature as discussed in #58.
Given the following in
_config.yml
:creating a file with the name "intro.md" (or ending in "-intro.md") would insert that file as the introductory text for a collection, posts, etc. according to its location and/or filters (categories, tags, etc.). The file would be fully rendered (Liquid and Markdown) where the following is placed:
{{ paginator.intro }}
Using this could be as simple as dropping an "intro.md" into a collections folder, but the general rule is, as long as you can get an entry to appear uniquely in a pagination page/autopage, you can use it as an intro simply by renaming it and removing its
layout:
, if necessary.For example,
examples/03-tags/_romance
could have a filehistrom-intro.md
as follows:and it will be rendered like so after adding
{{ paginator.intro }}
to_layouts/autopage_collection.html
:This also works for posts. Adding
{{ paginator.intro }}
toexamples/01-typicalblog/_layouts/home.html
and creating_posts/0000-00-00-main-intro.md
as follows:would render as follows: