From fec892047e4c0b810981fa8f20223e0b1c4f72b4 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 15 Jun 2026 18:17:10 -0400 Subject: refactor. added rss feed. --- README.md | 12 +- demo/demo.webp | Bin 0 -> 19374 bytes demo/dst/.files | 8 + demo/dst/404.html | 32 ++++ demo/dst/about.html | 32 ++++ .../an-interesting-article/assets/stamps.webp | Bin 0 -> 46960 bytes .../dst/articles/an-interesting-article/index.html | 34 +++++ .../assets/japanese-train.webp | Bin 0 -> 128168 bytes .../another-interesting-article/index.html | 34 +++++ demo/dst/articles/article3.html | 32 ++++ demo/dst/favicon.png | Bin 0 -> 393 bytes demo/dst/index.html | 37 +++++ demo/dst/lists/board-games.html | 38 +++++ demo/dst/lists/movies.html | 38 +++++ demo/dst/rss.xml | 39 +++++ demo/dst/sitemap.xml | 14 ++ demo/dst/style.css | 54 +++++++ demo/example.webp | Bin 0 -> 15022 bytes demo/src/404.md | 3 + demo/src/_footer.html | 2 + demo/src/_header.html | 28 ++++ demo/src/about.md | 3 + .../an-interesting-article/assets/stamps.webp | Bin 0 -> 46960 bytes demo/src/articles/an-interesting-article/index.md | 12 ++ .../assets/japanese-train.webp | Bin 0 -> 128168 bytes .../articles/another-interesting-article/index.md | 12 ++ demo/src/articles/article3.md | 8 + demo/src/favicon.png | Bin 0 -> 393 bytes demo/src/lists/board-games.md | 14 ++ demo/src/lists/movies.md | 13 ++ demo/src/style.css | 54 +++++++ example/dst/.files | 11 -- example/dst/404.html | 33 ---- example/dst/about.html | 33 ---- .../an-interesting-article/assets/stamps.webp | Bin 46960 -> 0 bytes .../dst/articles/an-interesting-article/index.html | 37 ----- .../assets/japanese-train.webp | Bin 128168 -> 0 bytes .../another-interesting-article/index.html | 37 ----- example/dst/articles/article3.html | 33 ---- example/dst/favicon.png | Bin 393 -> 0 bytes example/dst/index.html | 41 ----- example/dst/lists/board-games.html | 41 ----- example/dst/lists/movies.html | 41 ----- example/dst/sitemap.xml | 14 -- example/dst/style.css | 54 ------- example/example.webp | Bin 15022 -> 0 bytes example/src/404.md | 3 - example/src/_footer.html | 2 - example/src/_header.html | 28 ---- example/src/about.md | 3 - .../an-interesting-article/assets/stamps.webp | Bin 46960 -> 0 bytes .../src/articles/an-interesting-article/index.md | 12 -- .../assets/japanese-train.webp | Bin 128168 -> 0 bytes .../articles/another-interesting-article/index.md | 12 -- example/src/articles/article3.md | 8 - example/src/favicon.png | Bin 393 -> 0 bytes example/src/lists/board-games.md | 14 -- example/src/lists/movies.md | 13 -- example/src/style.css | 54 ------- ssg-blog | 167 +++++++++++++-------- 60 files changed, 652 insertions(+), 592 deletions(-) create mode 100644 demo/demo.webp create mode 100644 demo/dst/.files create mode 100644 demo/dst/404.html create mode 100644 demo/dst/about.html create mode 100644 demo/dst/articles/an-interesting-article/assets/stamps.webp create mode 100644 demo/dst/articles/an-interesting-article/index.html create mode 100644 demo/dst/articles/another-interesting-article/assets/japanese-train.webp create mode 100644 demo/dst/articles/another-interesting-article/index.html create mode 100644 demo/dst/articles/article3.html create mode 100644 demo/dst/favicon.png create mode 100644 demo/dst/index.html create mode 100644 demo/dst/lists/board-games.html create mode 100644 demo/dst/lists/movies.html create mode 100644 demo/dst/rss.xml create mode 100644 demo/dst/sitemap.xml create mode 100644 demo/dst/style.css create mode 100644 demo/example.webp create mode 100644 demo/src/404.md create mode 100644 demo/src/_footer.html create mode 100644 demo/src/_header.html create mode 100644 demo/src/about.md create mode 100644 demo/src/articles/an-interesting-article/assets/stamps.webp create mode 100644 demo/src/articles/an-interesting-article/index.md create mode 100644 demo/src/articles/another-interesting-article/assets/japanese-train.webp create mode 100644 demo/src/articles/another-interesting-article/index.md create mode 100644 demo/src/articles/article3.md create mode 100644 demo/src/favicon.png create mode 100644 demo/src/lists/board-games.md create mode 100644 demo/src/lists/movies.md create mode 100644 demo/src/style.css delete mode 100644 example/dst/.files delete mode 100644 example/dst/404.html delete mode 100644 example/dst/about.html delete mode 100644 example/dst/articles/an-interesting-article/assets/stamps.webp delete mode 100644 example/dst/articles/an-interesting-article/index.html delete mode 100644 example/dst/articles/another-interesting-article/assets/japanese-train.webp delete mode 100644 example/dst/articles/another-interesting-article/index.html delete mode 100644 example/dst/articles/article3.html delete mode 100644 example/dst/favicon.png delete mode 100644 example/dst/index.html delete mode 100644 example/dst/lists/board-games.html delete mode 100644 example/dst/lists/movies.html delete mode 100644 example/dst/sitemap.xml delete mode 100644 example/dst/style.css delete mode 100644 example/example.webp delete mode 100644 example/src/404.md delete mode 100644 example/src/_footer.html delete mode 100644 example/src/_header.html delete mode 100644 example/src/about.md delete mode 100644 example/src/articles/an-interesting-article/assets/stamps.webp delete mode 100644 example/src/articles/an-interesting-article/index.md delete mode 100644 example/src/articles/another-interesting-article/assets/japanese-train.webp delete mode 100644 example/src/articles/another-interesting-article/index.md delete mode 100644 example/src/articles/article3.md delete mode 100644 example/src/favicon.png delete mode 100644 example/src/lists/board-games.md delete mode 100644 example/src/lists/movies.md delete mode 100644 example/src/style.css diff --git a/README.md b/README.md index 1dd1461..8423c32 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ This is a modification to the simple static site generator '[ssg](https://romanzolotarev.com/bin/ssg)' by Roman Zolotarev. This is a markdown to HTML static site generator that also creates a minimal blog index page with category headings and posts sorted by date using YAML frontmatter in markdown files. -![example](example/example.webp) +It also generates a sitemap.xml and rss.xml file. + +![demo of generated site](demo/demo.webp) # Install / Usage @@ -23,16 +25,16 @@ publish: false --- ``` -If a file has no frontmatter, no `date`, or `publish: false`, the page won't be included in the index. It will still be rendered in sitemap.xml. +If a file has no frontmatter, no `date`, or `publish: false`, the page won't be included in the index, sitemap, or RSS feed. Setting `publish: true` is optional and equivalent to not having `publish` at all. -## Example +## Demo -There is an example directory in this repo to show you how to set up the files (src) and what the output looks like (dst). This was the command used to generate the example output: +There is a demo directory in this repo to show you an example of how to set up the files (src) and what the output looks like (dst). This was the command used to generate the demo output: ``` -./ssg-blog example/src example/dst 'https://example.org' +./ssg-blog demo/src demo/dst 'https://example.org' ``` Note a few things about the output: diff --git a/demo/demo.webp b/demo/demo.webp new file mode 100644 index 0000000..40f42d0 Binary files /dev/null and b/demo/demo.webp differ diff --git a/demo/dst/.files b/demo/dst/.files new file mode 100644 index 0000000..f7d8b18 --- /dev/null +++ b/demo/dst/.files @@ -0,0 +1,8 @@ +./404.md +./about.md +./lists/movies.md +./lists/board-games.md +./articles/an-interesting-article/index.md +./articles/article3.md +./articles/another-interesting-article/index.md +./style.css diff --git a/demo/dst/404.html b/demo/dst/404.html new file mode 100644 index 0000000..b6e2d1e --- /dev/null +++ b/demo/dst/404.html @@ -0,0 +1,32 @@ + + + + + + + + + +
+ +
+  _____                           _      
+ | ____|_  ____ _ _ __ ___  _ __ | | ___ 
+ |  _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
+ | |___ >  < (_| | | | | | | |_) | |  __/
+ |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
+                           |_|           
+                              example.org
+
+
+ +
+

404 Not Found

+

I couldn’t find that page.

+ + diff --git a/demo/dst/about.html b/demo/dst/about.html new file mode 100644 index 0000000..b17b7fe --- /dev/null +++ b/demo/dst/about.html @@ -0,0 +1,32 @@ + + + + + + + + + +
+ +
+  _____                           _      
+ | ____|_  ____ _ _ __ ___  _ __ | | ___ 
+ |  _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
+ | |___ >  < (_| | | | | | | |_) | |  __/
+ |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
+                           |_|           
+                              example.org
+
+
+ +
+

About

+

Here is an about page for my website

+ + diff --git a/demo/dst/articles/an-interesting-article/assets/stamps.webp b/demo/dst/articles/an-interesting-article/assets/stamps.webp new file mode 100644 index 0000000..9785ce7 Binary files /dev/null and b/demo/dst/articles/an-interesting-article/assets/stamps.webp differ diff --git a/demo/dst/articles/an-interesting-article/index.html b/demo/dst/articles/an-interesting-article/index.html new file mode 100644 index 0000000..ea236df --- /dev/null +++ b/demo/dst/articles/an-interesting-article/index.html @@ -0,0 +1,34 @@ + + + + + + + This is a very interesting article about stamps + + +
+ +
+  _____                           _      
+ | ____|_  ____ _ _ __ ___  _ __ | | ___ 
+ |  _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
+ | |___ >  < (_| | | | | | | |_) | |  __/
+ |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
+                           |_|           
+                              example.org
+
+
+ +
+

This is a very interesting article about stamps

+

Here is a picture of some cool stamps

+

+

Thank you for reading my nice article.

+ + diff --git a/demo/dst/articles/another-interesting-article/assets/japanese-train.webp b/demo/dst/articles/another-interesting-article/assets/japanese-train.webp new file mode 100644 index 0000000..c4cab3e Binary files /dev/null and b/demo/dst/articles/another-interesting-article/assets/japanese-train.webp differ diff --git a/demo/dst/articles/another-interesting-article/index.html b/demo/dst/articles/another-interesting-article/index.html new file mode 100644 index 0000000..bc82292 --- /dev/null +++ b/demo/dst/articles/another-interesting-article/index.html @@ -0,0 +1,34 @@ + + + + + + + I love trains + + +
+ +
+  _____                           _      
+ | ____|_  ____ _ _ __ ___  _ __ | | ___ 
+ |  _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
+ | |___ >  < (_| | | | | | | |_) | |  __/
+ |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
+                           |_|           
+                              example.org
+
+
+ +
+

I love trains

+

Aren’t Japanese trains great? I particularly like the boxy ones. Here is a picture of a train:

+

+

Thank you for looking at this train

+ + diff --git a/demo/dst/articles/article3.html b/demo/dst/articles/article3.html new file mode 100644 index 0000000..2b2c5f9 --- /dev/null +++ b/demo/dst/articles/article3.html @@ -0,0 +1,32 @@ + + + + + + + This is a third article! + + +
+ +
+  _____                           _      
+ | ____|_  ____ _ _ __ ___  _ __ | | ___ 
+ |  _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
+ | |___ >  < (_| | | | | | | |_) | |  __/
+ |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
+                           |_|           
+                              example.org
+
+
+ +
+

Article 3

+

Wow another one

+ + diff --git a/demo/dst/favicon.png b/demo/dst/favicon.png new file mode 100644 index 0000000..4c22246 Binary files /dev/null and b/demo/dst/favicon.png differ diff --git a/demo/dst/index.html b/demo/dst/index.html new file mode 100644 index 0000000..bfc86b6 --- /dev/null +++ b/demo/dst/index.html @@ -0,0 +1,37 @@ + + + + + + + Example + + +
+ +
+  _____                           _      
+ | ____|_  ____ _ _ __ ___  _ __ | | ___ 
+ |  _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
+ | |___ >  < (_| | | | | | | |_) | |  __/
+ |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
+                           |_|           
+                              example.org
+
+
+ +
+

Articles

+2024-10-04: This is a very interesting article about stamps
+2024-09-10: I love trains
+2023-10-08: This is a third article!
+

Lists

+2024-07-12: Board games
+2022-06-05: Movies
+ + diff --git a/demo/dst/lists/board-games.html b/demo/dst/lists/board-games.html new file mode 100644 index 0000000..b85ce6b --- /dev/null +++ b/demo/dst/lists/board-games.html @@ -0,0 +1,38 @@ + + + + + + + Board games + + +
+ +
+  _____                           _      
+ | ____|_  ____ _ _ __ ___  _ __ | | ___ 
+ |  _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
+ | |___ >  < (_| | | | | | | |_) | |  __/
+ |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
+                           |_|           
+                              example.org
+
+
+ +
+

Board Games

+

Here are some board games I like:

+
    +
  1. Puerto Rico
  2. +
  3. Ascension: Chronicle of the Godslayer
  4. +
  5. Twilight Struggle
  6. +
+

Play them with me, thanks.

+ + diff --git a/demo/dst/lists/movies.html b/demo/dst/lists/movies.html new file mode 100644 index 0000000..496e0d1 --- /dev/null +++ b/demo/dst/lists/movies.html @@ -0,0 +1,38 @@ + + + + + + + Movies + + +
+ +
+  _____                           _      
+ | ____|_  ____ _ _ __ ___  _ __ | | ___ 
+ |  _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
+ | |___ >  < (_| | | | | | | |_) | |  __/
+ |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
+                           |_|           
+                              example.org
+
+
+ +
+

A List of Movies

+

Here are my favorite movies

+
    +
  1. Primer
  2. +
  3. The Lighthouse
  4. +
  5. Tetsuo: The Iron Man
  6. +
+

I hope you enjoyed this insightful article.

+ + diff --git a/demo/dst/rss.xml b/demo/dst/rss.xml new file mode 100644 index 0000000..34d2e0a --- /dev/null +++ b/demo/dst/rss.xml @@ -0,0 +1,39 @@ + + + +Blog +https://example.org/ +Blog + + +This is a very interesting article about stamps +https://example.org/articles/an-interesting-article/ +https://example.org/articles/an-interesting-article/ +Fri, 04 Oct 2024 00:00:00 GMT + + +I love trains +https://example.org/articles/another-interesting-article/ +https://example.org/articles/another-interesting-article/ +Tue, 10 Sep 2024 00:00:00 GMT + + +Board games +https://example.org/lists/board-games.html +https://example.org/lists/board-games.html +Fri, 12 Jul 2024 00:00:00 GMT + + +This is a third article! +https://example.org/articles/article3.html +https://example.org/articles/article3.html +Sun, 08 Oct 2023 00:00:00 GMT + + +Movies +https://example.org/lists/movies.html +https://example.org/lists/movies.html +Sun, 05 Jun 2022 00:00:00 GMT + + + diff --git a/demo/dst/sitemap.xml b/demo/dst/sitemap.xml new file mode 100644 index 0000000..6d48f32 --- /dev/null +++ b/demo/dst/sitemap.xml @@ -0,0 +1,14 @@ + + +https://example.org/404.html2026-06-151.0 +https://example.org/about.html2026-06-151.0 +https://example.org/lists/movies.html2026-06-151.0 +https://example.org/lists/board-games.html2026-06-151.0 +https://example.org/articles/an-interesting-article/2026-06-151.0 +https://example.org/articles/article3.html2026-06-151.0 +https://example.org/articles/another-interesting-article/2026-06-151.0 + diff --git a/demo/dst/style.css b/demo/dst/style.css new file mode 100644 index 0000000..5080521 --- /dev/null +++ b/demo/dst/style.css @@ -0,0 +1,54 @@ +html { + font-size: 100%; + font-family:sans-serif; + /* font-family:sans-serif; */ + /* font:1.2em/1.62 sans-serif; */ +} + +body { + line-height: 1.6; + max-width:40em; + background-color: #ededed; + margin: auto; +} + +.container { + text-align: center; +} + +.container pre { + display: inline-block; + text-align: left; + line-height: 1.0; +} + +#header { + text-decoration: none; + color: inherit; + font-size:125%; +} + +#navigation { + font-family:monospace; + font-size:125%; +} + +h1 { font-size: 1.4rem; } +h2 { font-size: 1.2rem; } +h3 { font-size: 1.0rem;} + +a:link, a:visited { + color: #2626FF; +} + +a:hover, a:focus { + color: #4c4cFF; +} + +li + li { + margin-top:0.2em; +} + +ul img { + vertical-align:middle; +} diff --git a/demo/example.webp b/demo/example.webp new file mode 100644 index 0000000..d9153d9 Binary files /dev/null and b/demo/example.webp differ diff --git a/demo/src/404.md b/demo/src/404.md new file mode 100644 index 0000000..a0aa728 --- /dev/null +++ b/demo/src/404.md @@ -0,0 +1,3 @@ +# 404 Not Found + +I couldn't find that page. diff --git a/demo/src/_footer.html b/demo/src/_footer.html new file mode 100644 index 0000000..308b1d0 --- /dev/null +++ b/demo/src/_footer.html @@ -0,0 +1,2 @@ + + diff --git a/demo/src/_header.html b/demo/src/_header.html new file mode 100644 index 0000000..ca28d40 --- /dev/null +++ b/demo/src/_header.html @@ -0,0 +1,28 @@ + + + + + + + Example + + +
+ +
+  _____                           _      
+ | ____|_  ____ _ _ __ ___  _ __ | | ___ 
+ |  _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
+ | |___ >  < (_| | | | | | | |_) | |  __/
+ |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
+                           |_|           
+                              example.org
+
+
+ +
diff --git a/demo/src/about.md b/demo/src/about.md new file mode 100644 index 0000000..1b073d8 --- /dev/null +++ b/demo/src/about.md @@ -0,0 +1,3 @@ +# About + +Here is an about page for my website diff --git a/demo/src/articles/an-interesting-article/assets/stamps.webp b/demo/src/articles/an-interesting-article/assets/stamps.webp new file mode 100644 index 0000000..9785ce7 Binary files /dev/null and b/demo/src/articles/an-interesting-article/assets/stamps.webp differ diff --git a/demo/src/articles/an-interesting-article/index.md b/demo/src/articles/an-interesting-article/index.md new file mode 100644 index 0000000..779f4b6 --- /dev/null +++ b/demo/src/articles/an-interesting-article/index.md @@ -0,0 +1,12 @@ +--- +title: This is a very interesting article about stamps +date: 2024-10-04 +--- + +# This is a very interesting article about stamps + +Here is a picture of some cool stamps + +![](assets/stamps.webp) + +Thank you for reading my nice article. diff --git a/demo/src/articles/another-interesting-article/assets/japanese-train.webp b/demo/src/articles/another-interesting-article/assets/japanese-train.webp new file mode 100644 index 0000000..c4cab3e Binary files /dev/null and b/demo/src/articles/another-interesting-article/assets/japanese-train.webp differ diff --git a/demo/src/articles/another-interesting-article/index.md b/demo/src/articles/another-interesting-article/index.md new file mode 100644 index 0000000..4e5d9b7 --- /dev/null +++ b/demo/src/articles/another-interesting-article/index.md @@ -0,0 +1,12 @@ +--- +title: I love trains +date: 2024-09-10 +--- + +# I love trains + +Aren't Japanese trains great? I particularly like the boxy ones. Here is a picture of a train: + +![](assets/japanese-train.webp) + +Thank you for looking at this train diff --git a/demo/src/articles/article3.md b/demo/src/articles/article3.md new file mode 100644 index 0000000..c98ebba --- /dev/null +++ b/demo/src/articles/article3.md @@ -0,0 +1,8 @@ +--- +title: This is a third article! +date: 2023-10-08 +--- + +# Article 3 + +Wow another one diff --git a/demo/src/favicon.png b/demo/src/favicon.png new file mode 100644 index 0000000..4c22246 Binary files /dev/null and b/demo/src/favicon.png differ diff --git a/demo/src/lists/board-games.md b/demo/src/lists/board-games.md new file mode 100644 index 0000000..6a40080 --- /dev/null +++ b/demo/src/lists/board-games.md @@ -0,0 +1,14 @@ +--- +title: Board games +date: 2024-07-12 +--- + +# Board Games + +Here are some board games I like: + +1. Puerto Rico +2. Ascension: Chronicle of the Godslayer +3. Twilight Struggle + +Play them with me, thanks. diff --git a/demo/src/lists/movies.md b/demo/src/lists/movies.md new file mode 100644 index 0000000..92d82e6 --- /dev/null +++ b/demo/src/lists/movies.md @@ -0,0 +1,13 @@ +--- +title: Movies +date: 2022-06-05 +--- +# A List of Movies + +Here are my favorite movies + +1. Primer +2. The Lighthouse +3. Tetsuo: The Iron Man + +I hope you enjoyed this insightful article. diff --git a/demo/src/style.css b/demo/src/style.css new file mode 100644 index 0000000..5080521 --- /dev/null +++ b/demo/src/style.css @@ -0,0 +1,54 @@ +html { + font-size: 100%; + font-family:sans-serif; + /* font-family:sans-serif; */ + /* font:1.2em/1.62 sans-serif; */ +} + +body { + line-height: 1.6; + max-width:40em; + background-color: #ededed; + margin: auto; +} + +.container { + text-align: center; +} + +.container pre { + display: inline-block; + text-align: left; + line-height: 1.0; +} + +#header { + text-decoration: none; + color: inherit; + font-size:125%; +} + +#navigation { + font-family:monospace; + font-size:125%; +} + +h1 { font-size: 1.4rem; } +h2 { font-size: 1.2rem; } +h3 { font-size: 1.0rem;} + +a:link, a:visited { + color: #2626FF; +} + +a:hover, a:focus { + color: #4c4cFF; +} + +li + li { + margin-top:0.2em; +} + +ul img { + vertical-align:middle; +} diff --git a/example/dst/.files b/example/dst/.files deleted file mode 100644 index 331242d..0000000 --- a/example/dst/.files +++ /dev/null @@ -1,11 +0,0 @@ -./style.css -./lists/board-games.md -./lists/movies.md -./articles/an-interesting-article/index.md -./articles/an-interesting-article/assets/stamps.webp -./articles/another-interesting-article/index.md -./articles/another-interesting-article/assets/japanese-train.webp -./articles/article3.md -./about.md -./404.md -./favicon.png diff --git a/example/dst/404.html b/example/dst/404.html deleted file mode 100644 index 4a91725..0000000 --- a/example/dst/404.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - Example - - -
- -
-
-▄███▄      ▄  ██   █▀▄▀█ █ ▄▄  █     ▄███▄   
-█▀   ▀ ▀▄   █ █ █  █ █ █ █   █ █     █▀   ▀  
-██▄▄     █ ▀  █▄▄█ █ ▄ █ █▀▀▀  █     ██▄▄    
-█▄   ▄▀ ▄ █   █  █ █   █ █     ███▄  █▄   ▄▀ 
-▀███▀  █   ▀▄    █    █   █        ▀ ▀███▀   
-        ▀       █    ▀     ▀                 
-               ▀                             
-
-
- -
-

404 Not Found

- -

I couldn't find that page.

- - diff --git a/example/dst/about.html b/example/dst/about.html deleted file mode 100644 index 89a14bf..0000000 --- a/example/dst/about.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - Example - - -
- -
-
-▄███▄      ▄  ██   █▀▄▀█ █ ▄▄  █     ▄███▄   
-█▀   ▀ ▀▄   █ █ █  █ █ █ █   █ █     █▀   ▀  
-██▄▄     █ ▀  █▄▄█ █ ▄ █ █▀▀▀  █     ██▄▄    
-█▄   ▄▀ ▄ █   █  █ █   █ █     ███▄  █▄   ▄▀ 
-▀███▀  █   ▀▄    █    █   █        ▀ ▀███▀   
-        ▀       █    ▀     ▀                 
-               ▀                             
-
-
- -
-

About

- -

Here is an about page for my website

- - diff --git a/example/dst/articles/an-interesting-article/assets/stamps.webp b/example/dst/articles/an-interesting-article/assets/stamps.webp deleted file mode 100644 index 9785ce7..0000000 Binary files a/example/dst/articles/an-interesting-article/assets/stamps.webp and /dev/null differ diff --git a/example/dst/articles/an-interesting-article/index.html b/example/dst/articles/an-interesting-article/index.html deleted file mode 100644 index 8e65041..0000000 --- a/example/dst/articles/an-interesting-article/index.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - Example - - -
- -
-
-▄███▄      ▄  ██   █▀▄▀█ █ ▄▄  █     ▄███▄   
-█▀   ▀ ▀▄   █ █ █  █ █ █ █   █ █     █▀   ▀  
-██▄▄     █ ▀  █▄▄█ █ ▄ █ █▀▀▀  █     ██▄▄    
-█▄   ▄▀ ▄ █   █  █ █   █ █     ███▄  █▄   ▄▀ 
-▀███▀  █   ▀▄    █    █   █        ▀ ▀███▀   
-        ▀       █    ▀     ▀                 
-               ▀                             
-
-
- -
-

This is a very interesting article about stamps

- -

Here is a picture of some cool stamps

- -

- -

Thank you for reading my nice article.

- - diff --git a/example/dst/articles/another-interesting-article/assets/japanese-train.webp b/example/dst/articles/another-interesting-article/assets/japanese-train.webp deleted file mode 100644 index c4cab3e..0000000 Binary files a/example/dst/articles/another-interesting-article/assets/japanese-train.webp and /dev/null differ diff --git a/example/dst/articles/another-interesting-article/index.html b/example/dst/articles/another-interesting-article/index.html deleted file mode 100644 index 010c0f1..0000000 --- a/example/dst/articles/another-interesting-article/index.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - Example - - -
- -
-
-▄███▄      ▄  ██   █▀▄▀█ █ ▄▄  █     ▄███▄   
-█▀   ▀ ▀▄   █ █ █  █ █ █ █   █ █     █▀   ▀  
-██▄▄     █ ▀  █▄▄█ █ ▄ █ █▀▀▀  █     ██▄▄    
-█▄   ▄▀ ▄ █   █  █ █   █ █     ███▄  █▄   ▄▀ 
-▀███▀  █   ▀▄    █    █   █        ▀ ▀███▀   
-        ▀       █    ▀     ▀                 
-               ▀                             
-
-
- -
-

I love trains

- -

Aren't Japanese trains great? I particularly like the boxy ones. Here is a picture of a train:

- -

- -

Thank you for looking at this train

- - diff --git a/example/dst/articles/article3.html b/example/dst/articles/article3.html deleted file mode 100644 index 75783b7..0000000 --- a/example/dst/articles/article3.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - Example - - -
- -
-
-▄███▄      ▄  ██   █▀▄▀█ █ ▄▄  █     ▄███▄   
-█▀   ▀ ▀▄   █ █ █  █ █ █ █   █ █     █▀   ▀  
-██▄▄     █ ▀  █▄▄█ █ ▄ █ █▀▀▀  █     ██▄▄    
-█▄   ▄▀ ▄ █   █  █ █   █ █     ███▄  █▄   ▄▀ 
-▀███▀  █   ▀▄    █    █   █        ▀ ▀███▀   
-        ▀       █    ▀     ▀                 
-               ▀                             
-
-
- -
-

Article 3

- -

Wow another one

- - diff --git a/example/dst/favicon.png b/example/dst/favicon.png deleted file mode 100644 index 4c22246..0000000 Binary files a/example/dst/favicon.png and /dev/null differ diff --git a/example/dst/index.html b/example/dst/index.html deleted file mode 100644 index 681fec9..0000000 --- a/example/dst/index.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Example - - -
- -
-
-▄███▄      ▄  ██   █▀▄▀█ █ ▄▄  █     ▄███▄   
-█▀   ▀ ▀▄   █ █ █  █ █ █ █   █ █     █▀   ▀  
-██▄▄     █ ▀  █▄▄█ █ ▄ █ █▀▀▀  █     ██▄▄    
-█▄   ▄▀ ▄ █   █  █ █   █ █     ███▄  █▄   ▄▀ 
-▀███▀  █   ▀▄    █    █   █        ▀ ▀███▀   
-        ▀       █    ▀     ▀                 
-               ▀                             
-
-
- -
-

Articles

- -

Lists

- - - diff --git a/example/dst/lists/board-games.html b/example/dst/lists/board-games.html deleted file mode 100644 index 5a54f33..0000000 --- a/example/dst/lists/board-games.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Example - - -
- -
-
-▄███▄      ▄  ██   █▀▄▀█ █ ▄▄  █     ▄███▄   
-█▀   ▀ ▀▄   █ █ █  █ █ █ █   █ █     █▀   ▀  
-██▄▄     █ ▀  █▄▄█ █ ▄ █ █▀▀▀  █     ██▄▄    
-█▄   ▄▀ ▄ █   █  █ █   █ █     ███▄  █▄   ▄▀ 
-▀███▀  █   ▀▄    █    █   █        ▀ ▀███▀   
-        ▀       █    ▀     ▀                 
-               ▀                             
-
-
- -
-

Board Games

- -

Here are some board games I like:

- -
    -
  1. Puerto Rico
  2. -
  3. Ascension: Chronicle of the Godslayer
  4. -
  5. Twilight Struggle
  6. -
- -

Play them with me, thanks.

- - diff --git a/example/dst/lists/movies.html b/example/dst/lists/movies.html deleted file mode 100644 index dc7fc57..0000000 --- a/example/dst/lists/movies.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Example - - -
- -
-
-▄███▄      ▄  ██   █▀▄▀█ █ ▄▄  █     ▄███▄   
-█▀   ▀ ▀▄   █ █ █  █ █ █ █   █ █     █▀   ▀  
-██▄▄     █ ▀  █▄▄█ █ ▄ █ █▀▀▀  █     ██▄▄    
-█▄   ▄▀ ▄ █   █  █ █   █ █     ███▄  █▄   ▄▀ 
-▀███▀  █   ▀▄    █    █   █        ▀ ▀███▀   
-        ▀       █    ▀     ▀                 
-               ▀                             
-
-
- -
-

A List of Movies

- -

Here are my favorite movies

- -
    -
  1. Primer
  2. -
  3. The Lighthouse
  4. -
  5. Tetsuo: The Iron Man
  6. -
- -

I hope you enjoyed this insightful article.

- - diff --git a/example/dst/sitemap.xml b/example/dst/sitemap.xml deleted file mode 100644 index 945ab51..0000000 --- a/example/dst/sitemap.xml +++ /dev/null @@ -1,14 +0,0 @@ - - -https://example.org/lists/board-games.html2024-10-101.0 -https://example.org/lists/movies.html2024-10-101.0 -https://example.org/articles/an-interesting-article/2024-10-101.0 -https://example.org/articles/another-interesting-article/2024-10-101.0 -https://example.org/articles/article3.html2024-10-101.0 -https://example.org/about.html2024-10-101.0 -https://example.org/404.html2024-10-101.0 - diff --git a/example/dst/style.css b/example/dst/style.css deleted file mode 100644 index 5080521..0000000 --- a/example/dst/style.css +++ /dev/null @@ -1,54 +0,0 @@ -html { - font-size: 100%; - font-family:sans-serif; - /* font-family:sans-serif; */ - /* font:1.2em/1.62 sans-serif; */ -} - -body { - line-height: 1.6; - max-width:40em; - background-color: #ededed; - margin: auto; -} - -.container { - text-align: center; -} - -.container pre { - display: inline-block; - text-align: left; - line-height: 1.0; -} - -#header { - text-decoration: none; - color: inherit; - font-size:125%; -} - -#navigation { - font-family:monospace; - font-size:125%; -} - -h1 { font-size: 1.4rem; } -h2 { font-size: 1.2rem; } -h3 { font-size: 1.0rem;} - -a:link, a:visited { - color: #2626FF; -} - -a:hover, a:focus { - color: #4c4cFF; -} - -li + li { - margin-top:0.2em; -} - -ul img { - vertical-align:middle; -} diff --git a/example/example.webp b/example/example.webp deleted file mode 100644 index d9153d9..0000000 Binary files a/example/example.webp and /dev/null differ diff --git a/example/src/404.md b/example/src/404.md deleted file mode 100644 index a0aa728..0000000 --- a/example/src/404.md +++ /dev/null @@ -1,3 +0,0 @@ -# 404 Not Found - -I couldn't find that page. diff --git a/example/src/_footer.html b/example/src/_footer.html deleted file mode 100644 index 308b1d0..0000000 --- a/example/src/_footer.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/example/src/_header.html b/example/src/_header.html deleted file mode 100644 index a0923f4..0000000 --- a/example/src/_header.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - Example - - -
- -
-
-▄███▄      ▄  ██   █▀▄▀█ █ ▄▄  █     ▄███▄   
-█▀   ▀ ▀▄   █ █ █  █ █ █ █   █ █     █▀   ▀  
-██▄▄     █ ▀  █▄▄█ █ ▄ █ █▀▀▀  █     ██▄▄    
-█▄   ▄▀ ▄ █   █  █ █   █ █     ███▄  █▄   ▄▀ 
-▀███▀  █   ▀▄    █    █   █        ▀ ▀███▀   
-        ▀       █    ▀     ▀                 
-               ▀                             
-
-
- -
diff --git a/example/src/about.md b/example/src/about.md deleted file mode 100644 index 1b073d8..0000000 --- a/example/src/about.md +++ /dev/null @@ -1,3 +0,0 @@ -# About - -Here is an about page for my website diff --git a/example/src/articles/an-interesting-article/assets/stamps.webp b/example/src/articles/an-interesting-article/assets/stamps.webp deleted file mode 100644 index 9785ce7..0000000 Binary files a/example/src/articles/an-interesting-article/assets/stamps.webp and /dev/null differ diff --git a/example/src/articles/an-interesting-article/index.md b/example/src/articles/an-interesting-article/index.md deleted file mode 100644 index 779f4b6..0000000 --- a/example/src/articles/an-interesting-article/index.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: This is a very interesting article about stamps -date: 2024-10-04 ---- - -# This is a very interesting article about stamps - -Here is a picture of some cool stamps - -![](assets/stamps.webp) - -Thank you for reading my nice article. diff --git a/example/src/articles/another-interesting-article/assets/japanese-train.webp b/example/src/articles/another-interesting-article/assets/japanese-train.webp deleted file mode 100644 index c4cab3e..0000000 Binary files a/example/src/articles/another-interesting-article/assets/japanese-train.webp and /dev/null differ diff --git a/example/src/articles/another-interesting-article/index.md b/example/src/articles/another-interesting-article/index.md deleted file mode 100644 index 4e5d9b7..0000000 --- a/example/src/articles/another-interesting-article/index.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: I love trains -date: 2024-09-10 ---- - -# I love trains - -Aren't Japanese trains great? I particularly like the boxy ones. Here is a picture of a train: - -![](assets/japanese-train.webp) - -Thank you for looking at this train diff --git a/example/src/articles/article3.md b/example/src/articles/article3.md deleted file mode 100644 index c98ebba..0000000 --- a/example/src/articles/article3.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: This is a third article! -date: 2023-10-08 ---- - -# Article 3 - -Wow another one diff --git a/example/src/favicon.png b/example/src/favicon.png deleted file mode 100644 index 4c22246..0000000 Binary files a/example/src/favicon.png and /dev/null differ diff --git a/example/src/lists/board-games.md b/example/src/lists/board-games.md deleted file mode 100644 index 6a40080..0000000 --- a/example/src/lists/board-games.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: Board games -date: 2024-07-12 ---- - -# Board Games - -Here are some board games I like: - -1. Puerto Rico -2. Ascension: Chronicle of the Godslayer -3. Twilight Struggle - -Play them with me, thanks. diff --git a/example/src/lists/movies.md b/example/src/lists/movies.md deleted file mode 100644 index 92d82e6..0000000 --- a/example/src/lists/movies.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Movies -date: 2022-06-05 ---- -# A List of Movies - -Here are my favorite movies - -1. Primer -2. The Lighthouse -3. Tetsuo: The Iron Man - -I hope you enjoyed this insightful article. diff --git a/example/src/style.css b/example/src/style.css deleted file mode 100644 index 5080521..0000000 --- a/example/src/style.css +++ /dev/null @@ -1,54 +0,0 @@ -html { - font-size: 100%; - font-family:sans-serif; - /* font-family:sans-serif; */ - /* font:1.2em/1.62 sans-serif; */ -} - -body { - line-height: 1.6; - max-width:40em; - background-color: #ededed; - margin: auto; -} - -.container { - text-align: center; -} - -.container pre { - display: inline-block; - text-align: left; - line-height: 1.0; -} - -#header { - text-decoration: none; - color: inherit; - font-size:125%; -} - -#navigation { - font-family:monospace; - font-size:125%; -} - -h1 { font-size: 1.4rem; } -h2 { font-size: 1.2rem; } -h3 { font-size: 1.0rem;} - -a:link, a:visited { - color: #2626FF; -} - -a:hover, a:focus { - color: #4c4cFF; -} - -li + li { - margin-top:0.2em; -} - -ul img { - vertical-align:middle; -} diff --git a/ssg-blog b/ssg-blog index 0e1418c..3c33dbe 100755 --- a/ssg-blog +++ b/ssg-blog @@ -40,15 +40,15 @@ main() { # files - h_file="$src/_header.html" - f_file="$src/_footer.html" - test -f "$f_file" && FOOTER=$(cat "$f_file") && export FOOTER - test -f "$h_file" && HEADER=$(cat "$h_file") && export HEADER + header_file="$src/_header.html" + footer_file="$src/_footer.html" + test -f "$footer_file" && FOOTER=$(cat "$footer_file") && export FOOTER + test -f "$header_file" && HEADER=$(cat "$header_file") && export HEADER list_dirs "$src" | (cd "$src" && cpio -pdu "$dst") - fs=$( + files=$( if test -f "$dst/.files"; then list_affected_files "$src" "$dst/.files" else @@ -56,40 +56,39 @@ main() { fi ) - if test -n "$fs"; then - echo "$fs" | tee "$dst/.files" + if test -n "$files"; then + echo "$files" | tee "$dst/.files" - if echo "$fs" | grep -q '\.md$'; then - if test -x "$(which lowdown 2>/dev/null)"; then - echo "$fs" | grep '\.md$' | - render_md_files_lowdown "$src" "$dst" + if echo "$files" | grep -q '\.md$'; then + if command -v lowdown >/dev/null 2>&1; then + md_cmd="lowdown --html-no-escapehtml --html-no-skiphtml --parse-no-metadata --parse-no-autolink" + elif command -v Markdown.pl >/dev/null 2>&1; then + md_cmd="Markdown.pl" else - if test -x "$(which Markdown.pl 2>/dev/null)"; then - echo "$fs" | grep '\.md$' | - render_md_files_Markdown_pl "$src" "$dst" - else - echo "couldn't find lowdown nor Markdown.pl" - exit 3 - fi + echo "couldn't find lowdown nor Markdown.pl" + exit 3 fi + echo "$files" | grep '\.md$' | + render_md_files "$src" "$dst" "$md_cmd" fi - echo "$fs" | grep '\.html$' | + echo "$files" | grep '\.html$' | render_html_files "$src" "$dst" - echo "$fs" | grep -Ev '\.md$|\.html$' | + echo "$files" | grep -Ev '\.md$|\.html$' | (cd "$src" && cpio -pu "$dst") fi printf '[ssg] ' >&2 - print_status 'file, ' 'files, ' "$fs" >&2 - - #index + print_status 'file, ' 'files, ' "$files" >&2 + # index render_index - # sitemap + # rss + render_rss + # sitemap date=$(date +%Y-%m-%d) urls=$(list_pages "$src") @@ -164,31 +163,24 @@ list_affected_files() { fi } -render_html_files() { - while read -r f; do - render_html_file <"$1/$f" >"$2/$f" - done +get_frontmatter_field() { + sed -n '/^'"$2"': /s/^'"$2"': //p' "$1" | head -n 1 } -render_md_files_lowdown() { +render_md_files() { while read -r f; do - title=$(sed -n '/^title: /s/^title: //p' "$1/$f" | head -n 1) + title=$(get_frontmatter_field "$1/$f" "title") content=$(sed '1 { /^---/ { :a N; /\n---/! ba; d} }' "$1/$f") - html_content=$(echo "$content" | lowdown --html-no-escapehtml --html-no-skiphtml --parse-no-metadata --parse-no-autolink) + html_content=$(echo "$content" | $3) echo "$HEADER" | sed "s|.*|$title|" > "$2/${f%\.md}.html" echo "$html_content" >> "$2/${f%\.md}.html" echo "$FOOTER" >> "$2/${f%\.md}.html" done } -render_md_files_Markdown_pl() { +render_html_files() { while read -r f; do - title=$(sed -n '/^title: /s/^title: //p' "$1/$f" | head -n 1) - content=$(sed '1 { /^---/ { :a N; /\n---/! ba; d} }' "$1/$f") - html_content=$(echo "$content" | Markdown.pl) - echo "$HEADER" | sed "s|.*|$title|" > "$2/${f%\.md}.html" - echo "$html_content" >> "$2/${f%\.md}.html" - echo "$FOOTER" >> "$2/${f%\.md}.html" + render_html_file <"$1/$f" >"$2/$f" done } @@ -203,47 +195,96 @@ render_html_file() { list_pages() { e="\\( -name '*.html' -o -name '*.md' \\)" cd "$1" && eval "find . -type f ! -path '*/.*' ! -path '*/_*' $IGNORE $e" | + while read -r f; do + case "$f" in + *.md) + test "$(get_frontmatter_field "$1/$f" "publish")" != "false" || continue + ;; + esac + echo "$f" + done | sed 's#^./##;s#.md$#.html#;s#/index.html$#/#' } -render_index() { - output="$dst/index.html" - echo "$HEADER" > "$output" - - find "$src" -mindepth 1 -maxdepth 1 -type d ! -path "*/.*" | sort | +list_articles() { + find "$1" -mindepth 1 -maxdepth 1 -type d ! -path "*/.*" | sort | while read -r category_dir; do category=$(basename "$category_dir") - find "$category_dir" -type f \( -name "*.md" -o -name "index.md" \) ! -path "*/.*" | while read -r article; do - publish=$(sed -n '/^publish: /s/^publish: //p' "$article" | head -n 1) - title=$(sed -n '/^title: /s/title: //p' "$article" | head -n 1) - date=$(sed -n '/^date: /s/date: //p' "$article" | head -n 1) - if [ "$publish" = "false" ] || [ -z "$date" ]; then - continue + test "$(get_frontmatter_field "$article" "publish")" != "false" || continue + date=$(get_frontmatter_field "$article" "date") + test -n "$date" || continue + title=$(get_frontmatter_field "$article" "title") + url="${article#"$1"}" + url="${url%.md}.html" + if [ "${url##*/}" = "index.html" ]; then + url="${url%/index.html}/" fi - article_url="${article#"$src"}" - article_url="${article_url%.md}.html" - if [ "${article_url##*/}" = "index.html" ]; then - article_url="${article_url%/index.html}/" - fi - article_url="${article_url#/}" - echo "$date|$title|$article_url" >> "/tmp/articles_$category.txt" + url="${url#/}" + echo "$category|$date|$title|$url" done + done +} - if [ -f "/tmp/articles_$category.txt" ]; then - echo "

$(echo "$category" | sed -E 's/_/ /g; s/(^|[ ])([a-z])/\1\U\2/g')

" >> "$output" - sort -r "/tmp/articles_$category.txt" | - while IFS='|' read -r date title url; do - echo "$date: $title
" >> "$output" - done - rm "/tmp/articles_$category.txt" +render_index() { + output="$dst/index.html" + echo "$HEADER" > "$output" + + last_category="" + list_articles "$src" | sort -t'|' -k1,1 -k2,2r | + while IFS='|' read -r category date title url; do + if [ "$category" != "$last_category" ]; then + display_category=$(echo "$category" | sed 's/_/ /g' | awk '{for(i=1;i<=NF;i++){s=$i;$i=toupper(substr(s,1,1)) substr(s,2)}; print}') + echo "

$display_category

" >> "$output" + last_category="$category" fi + echo "$date: $title
" >> "$output" done echo "$FOOTER" >> "$output" } +xml_escape() { + sed 's/&/\&/g; s//\>/g; s/"/\"/g' +} + +rfc822_date() { + if d=$(date -d "$1" -u +"%a, %d %b %Y %H:%M:%S GMT" 2>/dev/null); then + echo "$d" + else + echo "$1" + fi +} + +render_rss() { + list_articles "$src" | sort -t'|' -k2,2r | + { + echo '' + echo '' + echo '' + echo "Blog" + echo "$base_url/" + echo "Blog" + echo "" + + while IFS='|' read -r category date title url; do + escaped_title=$(echo "$title" | xml_escape) + escaped_url=$(echo "$url" | xml_escape) + pub_date=$(rfc822_date "$date") + echo '' + echo "$escaped_title" + echo "$base_url/$escaped_url" + echo "$base_url/$escaped_url" + echo "$pub_date" + echo '' + done + + echo '' + echo '' + } > "$dst/rss.xml" +} + render_sitemap() { urls="$1" base_url="$2" -- cgit v1.2.3