pdssg

Pandoc static site generator
Log | Files | Refs | README | LICENSE

commit 1c0592ee996433d0ed5942d1f6a4f653d00d3ea5
parent ea0c9c14467cc50cf0ad0e2ae8199943fa593fae
Author: Byron Torres <torresjrjr@pm.me>
Date:   Thu,  2 Jul 2020 23:57:51 +0100

New config for feeds directory

The directory for where feeds will be generated is now specified by the
contents of a `./_feeds` config file. This makes configuration free from
variables and syntax, and more filetree-based.

Diffstat:
MREADME.md | 22+++++++++++++---------
Mpdssg | 11++++++-----
2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/README.md b/README.md @@ -40,6 +40,7 @@ directory. ``` src/ |-- _ignore +|-- _feeds |-- index.md |-- about.md |-- posts.md @@ -143,20 +144,23 @@ Atom feeds allow readers to subscribe to a website's new content, like a blog. [RSS]: https://en.wikipedia.org/wiki/RSS pdssg can make Atom feeds from directories, with the directory's files as feed -entries. To do this, make an "Atom seed file" as such: +entries. To do this, you need to make a specified directory for your feeds, and +make an "Atom seed file" as such: -1. Note the path of the directory. -2. Prepend `./feeds/` to the path. -3. Append the `.md` file extension to the path. -4. Create a Markdown file with the path. -5. Write a YAML frontmatter to the file. +1. Create a feeds directory (e.g. `./feeds/`) and write it's path in the config + file `_feeds` +2. Note the path of a directory you want to make a feed (e.g. `./posts/`). +3. Prepend your feeds directory path to it (e.g. `./feeds/posts/`). +4. Append the `.md` file extension to the path (e.g. `./feeds/posts.md`). +5. Create a Markdown file with this path. This is the Atom seed file. +6. Write a YAML frontmatter to the file. Refer to the **example site** above for demonstration (the `posts/` directory). The Atom seed file will be converted to an Atom feed file. This resulting feed -will exist at the new path but with an `.xml` extension. In this example, the -atom feed will appear at `example.com/feeds/posts.xml`. Note, the `post.md` file -is not necessary for a feed, only a directory. +will exist at the new path but with an `.xml` extension instead of `.md`. In +this example, the atom feed will appear at `example.com/feeds/posts.xml`. Note, +the `./posts.md` file is not necessary for a feed, only a directory. **NOTE:** Atom entries are ordered alphanumerically by their corresponding filenames, not by their `date` specified by their YAML frontmatter. diff --git a/pdssg b/pdssg @@ -5,9 +5,6 @@ main() { echo "### Begin compiling ###" - # User options - FEEDS_DIR="./feeds" - prepare_dst find_feeds @@ -69,7 +66,11 @@ prepare_dst() { | grep -v -F -f $IGNORE_MD_FILE ) rm $IGNORE_MD_FILE - echo $MD_FILES + + echo "Finding feeds directory" + FEEDS_DIR="$(< ./_feeds)" + FEEDS_DIR=${FEEDSDIR:-./feeds} + echo "Dir: $FEEDS_DIR" } find_feeds() { @@ -78,7 +79,7 @@ find_feeds() { ATOM_SEEDS=$(find $FEEDS_DIR -type f -path '*.md') POSTS_DIRS=$(echo "$ATOM_SEEDS" | sed -e "s|^$FEEDS_DIR|.|" -e 's|\.md$||') - + echo $ATOM_SEEDS for posts_dir in $POSTS_DIRS