Skip to content

Commit

Permalink
Rssfix (#124)
Browse files Browse the repository at this point in the history
* ok

* typo fixes

* patch release with rss
  • Loading branch information
tlienart authored Apr 6, 2021
1 parent ca32799 commit ce1f977
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FranklinTemplates"
uuid = "3a985190-f512-4703-8d38-2a7944ed5916"
authors = ["Thibaut Lienart <[email protected]>"]
version = "0.8.13"
version = "0.8.14"

[deps]
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
Expand Down
37 changes: 37 additions & 0 deletions src/templates/common/_rss/head.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is based on Yandex's https://yandex.com/support/zen/website/rss-modify.html
The scope of this segment is the GLOBAL scope (variables defined in config.md).
For instance 'website_url' or 'website_description'.
Notes:
* namespaces (xmlns): https://validator.w3.org/feed/docs/howto/declare_namespaces.html
* best practices: https://www.rssboard.org/rss-profile
* fd2rss convers markdown to html and fixes or removes relative links
* fd_rss_feed_url is built out of {website_url}/{rss_file}.xml, you can change the
rss_file variable in your config file if you want to use something different than 'feed'
-->
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:georss="http://www.georss.org/georss">

<channel>
<title>
<![CDATA[ {{fd2rss website_title}} ]]>
</title>
<link> {{website_url}} </link>
<description>
<![CDATA[ {{fd2rss website_description}} ]]>
</description>
<atom:link
href="{{fd_rss_feed_url}}"
rel="self"
type="application/rss+xml" />
<!--
* items will be added here in chronological order
* the channel will then be closed
-->
55 changes: 55 additions & 0 deletions src/templates/common/_rss/item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!--
This is based on Yandex's https://yandex.com/support/zen/website/rss-modify.html
The scope of this segment is the LOCAL scope (page variables). For instance 'rss_title'.
Notes:
* the local var rss_description (or rss) *must* be given otherwise the item
is not generated.
* rss_title if not given is inferred from page title
* rss_pubdate if not given is inferred from the date of last modification
* the full content is not added by default but can be if the variable rss_full_content
is set to true (either globally or locally).
* RFC822 or RFC1123 is a date format required by RSS.
* there is debate about supporting one or several enclosures
(see https://www.rssboard.org/rss-profile#element-channel-item-enclosure).
We use the conservative 'only one' approach by default but you could tweak this by
defining your own `rss_enclosures` variable with a list of string and use that.
-->
<item>
<title>
<![CDATA[ {{fd2rss rss_title}} ]]>
</title>
<link> {{fd_full_url}} </link>
<guid> {{fd_full_url}} </guid>
<description>
<![CDATA[ {{fd2rss rss_description}} ]]>
</description>

<!-- note that fd_page_html is already HTML, so we don't use fd2rss here -->
{{if rss_full_content}}
<content:encoded>
<![CDATA[ {{fix_relative_links fd_page_html}} ]]>
</content:encoded>
{{end}}

<!-- RFC1123 enforces a RSS-compliant date formatting -->
<pubDate>{{RFC822 rss_pubdate}}</pubDate>

<!-- if given this must be an email, see specs -->
{{isnotempty rss_author}}
<author> {{rss_author}} </author>
{{end}}

{{isnotempty rss_category}}
<category> {{rss_category}} </category>
{{end}}

{{isnotempty rss_comments}}
<comments> {{rss_comments}} </comments>
{{end}}

{{isnotempty rss_enclosure}}
<enclosure> {{rss_enclosure}} </enclosure>
{{end}}
</item>
35 changes: 16 additions & 19 deletions src/templates/common/config.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
<!--
Add here global page variables to use throughout your
website.
The website_* must be defined for the RSS to work
Add here global page variables to use throughout your website.
-->
@def website_title = "Franklin Template"
@def website_descr = "Example website using Franklin"
@def website_url = "https://tlienart.github.io/FranklinTemplates.jl/"
+++
author = "Septimia Zenobia"
mintoclevel = 2

@def author = "Septimia Zenobia"
# Add here files or directories that should be ignored by Franklin, otherwise
# these files might be copied and, if markdown, processed by Franklin which
# you might not want. Indicate directories by ending the name with a `/`.
# Base files such as LICENSE.md and README.md are ignored by default.
ignore = ["node_modules/"]

@def mintoclevel = 2
# RSS (the website_{title, descr, url} must be defined to get RSS)
generate_rss = true
website_title = "Franklin Template"
website_descr = "Example website using Franklin"
website_url = "https://tlienart.github.io/FranklinTemplates.jl/"
+++

<!--
Add here files or directories that should be ignored by Franklin, otherwise
these files might be copied and, if markdown, processed by Franklin which
you might not want. Indicate directories by ending the name with a `/`.
-->
@def ignore = ["node_modules/", "franklin", "franklin.pub"]

<!--
Add here global latex commands to use throughout your
pages. It can be math commands but does not need to be.
For instance:
* \newcommand{\phrase}{This is a long phrase to copy.}
Add here global latex commands to use throughout your pages.
-->
\newcommand{\R}{\mathbb R}
\newcommand{\scal}[1]{\langle #1 \rangle}

2 comments on commit ce1f977

@tlienart
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/33675

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.14 -m "<description of version>" ce1f977a06784c6461a1faa269d0fdc354b29f3b
git push origin v0.8.14

Please sign in to comment.