Adding two template variables to control the text and title of RSS links

This commit is contained in:
Tissevert 2020-04-19 18:07:46 +02:00
parent 3c19a2c568
commit 6c70281e3f
4 changed files with 13 additions and 1 deletions

View File

@ -154,7 +154,7 @@ The file is read by hablo when the blog is generated and its content gets includ
`-R, --rss`
Enables the generation of RSS feeds for each [lists](https://git.marvid.fr/Tissevert/hablo/wiki/Architectural%20choices#page-types) of articles. The feed consists in an additional `rss.xml` file placed in the same directory as the `index.html` and `all.html` files generated for. The feeds only include the most recent articles exactly as the «short» versions of each list, which means that they are affected by the use of the [`--preview-articles`](#number-of-articles-previewed) option.
Enables the generation of RSS feeds for each [list](https://git.marvid.fr/Tissevert/hablo/wiki/Architectural%20choices#page-types) of articles. The feed consists in an additional `rss.xml` file placed in the same directory as the `index.html` and `all.html` files generated for. The feeds only include the most recent articles exactly as the «short» versions of each list, which means that they are affected by the use of the [`--preview-articles`](#number-of-articles-previewed) option. When this option is enabled, hablo will also include links to the generated feeds in the list pages. Two [template variables](https://git.marvid.fr/Tissevert/hablo/wiki/Template%20variables#rsslinks) control respectively the content and the title of the link.
Note that this feature requires setting your site URL with [`--site-url`](#site-url).

View File

@ -68,6 +68,14 @@ metadata = {?by ${author} ?}on ${date}{? tagged ${tags}?}
If an article has an author, the rendered `metadata` string will start with «by <AUTHOR>», otherwise it will directly start with «on <SOME DATE>». Likewise all articles with tags will have their `metadata` end with « tagged » and then the list of comma-separated tags but if an article doesn't have tags, it will simply end after the date.
## rssLink
This template variable contains the text displayed in the link element pointing to the [RSS feed](https://git.marvid.fr/Tissevert/hablo/wiki/Command-line#rss) to each [list page](https://git.marvid.fr/Tissevert/hablo/wiki/Architectural%20choices#list-pages). This template is a constant and doesn't expect any templating variable.
## rssTitle
This template variable contains the title attribute of the link element pointing to the [RSS feed](https://git.marvid.fr/Tissevert/hablo/wiki/Command-line#rss) to each [list page](https://git.marvid.fr/Tissevert/hablo/wiki/Architectural%20choices#list-pages) that will be visible on mouse hover. The only templating variable it expects is `$tag` (which should be preferably [protected](https://git.marvid.fr/Tissevert/hablo/wiki/Template%20variables#template-variables) if you use it because `$tag` will be null on the main page containing a link to the general feed containing all the articles published on your blog).
## tagsList
The content of the `<h2>` element in the navigation `<div>` that lists all the tags of your blog.

View File

@ -8,4 +8,6 @@ latestLink = See only latest
latestPage = Latest articles
latestTaggedPage = Latest articles tagged ${tag}
metadata = {?by ${author} ?}on ${date}{? tagged ${tags}?}
rssLink = Subscribe
rssTitle = Follow articles{? tagged ${tag}?}
tagsList = Tags

View File

@ -39,6 +39,8 @@ variables = Map.fromList [
, ("latestPage", [])
, ("latestTaggedPage", ["tag"])
, ("metadata", ["author", "date", "tags"])
, ("rssLink", [])
, ("rssTitle", ["tag"])
, ("tagsList", [])
]