diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2021-05-25 00:33:12 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2021-05-25 00:33:12 -0600 |
commit | e667ddc7ee47d0897ffc5b569aadeafaa829d6a4 (patch) | |
tree | 6de6110ddce49a4873d31f0b0951c91efefe8d67 | |
parent | 09b96aff91012c1fb61275fa5da71593ee268b13 (diff) |
add content:encoded tag in rss and update readme
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | src/pyssg/rss.py | 3 | ||||
-rw-r--r-- | src/pyssg/template.py | 4 |
4 files changed, 14 insertions, 3 deletions
@@ -1,6 +1,10 @@ CHANGES ======= +v0.3.0 +------ + +* add better version printing * fix timezone * fix missing ref to obj * fix bad method call @@ -15,7 +15,7 @@ I'm writing this in *pYtHoN* (thought about doing it in Go, but I'm most comfort - [x] Tag functionality. - [ ] Open Graph (and similar) support. - [ ] Build `sitemap.xml` file. -- [ ] Build `rss.xml` file. +- [x] Build `rss.xml` file. - [x] Only build page if `*.md` is new or updated. - [ ] Extend this to tag pages and index (right now all tags and index is built no matter if no new/updated file is present). - [x] Configuration file as an alternative to using command line flags (configuration file options are prioritized). @@ -53,6 +53,8 @@ pyssg -s src_dir -d dst_dir -i That creates the desired directories with the basic templates that can be edited as desired. Place your `*.md` files somewhere inside the source directory (`src_dir` in the command above), but outside of the `templates` directory. It accepts sub-directories. +Strongly recommended to edit `rss.xml` template under `rss` directory, since it has a lot of placeholder values. + Build the site with: ```sh @@ -60,3 +62,5 @@ pyssg -s src_dir -d dst_dir -u https://base.url -b ``` That creates all `*.html` for the site and can be easily moved to the server. Here, the `-u` flag is technically optional in the sense that you'll not receive a warning/error, but it's used to prepend links with this URL (not strictly required everywhere), so don't ignore it; also don't include the trailing `/`. + +For now, the `-b`uild tag also creates a `rss.xml` file based on a template (created when initializing the directories/templates) adding all converted `*.md` files, meaning that separate `*.html` files should be included manually in the template. diff --git a/src/pyssg/rss.py b/src/pyssg/rss.py index 9cfe629..4cd4695 100644 --- a/src/pyssg/rss.py +++ b/src/pyssg/rss.py @@ -44,9 +44,10 @@ class RSSBuilder: i_f = f'{i_f} <item>\n' i_f = f'{i_f} <title>{p.title}</title>\n' i_f = f'{i_f} <link>{url}</link>\n' - i_f = f'{i_f} <description>{p.summary}</description>\n' i_f = f'{i_f} <guid isPermaLink="true">{url}</guid>\n' i_f = f'{i_f} <pubDate>{date}</pubDate>\n' + i_f = f'{i_f} <description>{p.summary}</description>\n' + i_f = f'{i_f} <content:encoded><![CDATA[{p.html}]]></content:encoded>\n' i_f = f'{i_f} </item>\n' return i_f diff --git a/src/pyssg/template.py b/src/pyssg/template.py index d62c40f..0c43f22 100644 --- a/src/pyssg/template.py +++ b/src/pyssg/template.py @@ -115,7 +115,9 @@ class Template(HF): os.chdir('rss') self.__write_template('rss.xml', ['<?xml version="1.0" encoding="UTF-8" ?>\n', - '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">\n', + '<rss version="2.0"\n', + ' xmlns:atom="http://www.w3.org/2005/Atom"\n', + ' xmlns:content="http://purl.org/rss/1.0/modules/content/">\n', ' <channel>\n', ' <title>$$TITLE</title>\n', ' <link>$$LINK</link>\n', |