Not Another Static Generator
Find a file
Peter Molnar a8e403ae04 After long discussions, mainly listening and reading, I'm giving up on GPL licencing and moving to Apache 2.0.
The short summary is that while I still sort of believe in what GPL stands for, reality is not that simple to immediately open source everything.

Because GPL is scary, many people avoid it, and one of the main achievements of open source should be that nobody has to reinvent the wheel.
2018-12-03 10:36:10 +00:00
assets/icomoon - asyncio tasks execution finally are triggered by run() and not immediately, special thanks to https://www.svenknebel.de for helping me figuring it out 2018-11-19 14:36:06 +00:00
templates - moved Tips from footer to bottom of each singular with an "encourage creation" header 2018-12-01 10:43:13 +00:00
tests test cleanup 2018-12-03 10:29:15 +00:00
.gitignore ignore test generated file for Exif 2018-12-03 10:29:32 +00:00
__init__.py v4.0a1 2018-07-20 16:47:25 +01:00
exiftool.py After long discussions, mainly listening and reading, I'm giving up on GPL licencing and moving to Apache 2.0. 2018-12-03 10:36:10 +00:00
LICENSE After long discussions, mainly listening and reading, I'm giving up on GPL licencing and moving to Apache 2.0. 2018-12-03 10:36:10 +00:00
nasg.py After long discussions, mainly listening and reading, I'm giving up on GPL licencing and moving to Apache 2.0. 2018-12-03 10:36:10 +00:00
pandoc.py After long discussions, mainly listening and reading, I'm giving up on GPL licencing and moving to Apache 2.0. 2018-12-03 10:36:10 +00:00
README.md - asyncio tasks execution finally are triggered by run() and not immediately, special thanks to https://www.svenknebel.de for helping me figuring it out 2018-11-19 14:36:06 +00:00
requirements.txt - webmention sending is back (only for RE: for now) via Telegraph 2018-08-15 11:02:59 +01:00
run - schema.org things, again 2018-09-04 22:58:25 +02:00
settings.py After long discussions, mainly listening and reading, I'm giving up on GPL licencing and moving to Apache 2.0. 2018-12-03 10:36:10 +00:00
tests.py After long discussions, mainly listening and reading, I'm giving up on GPL licencing and moving to Apache 2.0. 2018-12-03 10:36:10 +00:00

NASG - not another static generator...

Nearly 20 years ago I did my very first website with a thing called Microsoft FrontPage. I loved it. Times changed, and I wrote a CMS in PHP, first with flat files, then with MySQL, then moved on to WordPress.

Now I'm back on a static generator. I love it.

WARNING: this is a personal project, scratching my itches. No warranties. If you want to deploy it on your own, feel free to, but not all the things are documented.

## What does it do

  • content is structured in folders
  • content files are YAML frontmatter + Multimarkdown
  • EXIF from images are read via exiftool this is an external dependency
  • Markdown is converted with pandoc this is an external dependency

How it works

  • pulls in webmentions from https://webmention.io and stores them in .md files next to the index.md of a post (see later) as: [unix epoch]-[slugified source url].md

  • pulls in micropub from the queue received by the micropub receiver PHP (see later)

  • finds 'redirect' files:

    • anything with a .url extension
    • content is the URL to redirect to
    • filename without extension is the slug to redirect from
    • for HTTP 302
  • finds 'gone' files:

    • anything with a .del extension
    • filename without extension is the slug deleted
    • for HTTP 410
  • finds content:

    • all index.md files
    • corresponding comment .md file next to it
    • the parent directory name is the post slug
    • finds all images in the same directory (.jpg, .png, .gif)
      • reads EXIF data into a hidden, .[filename].json file next to the original file
      • generates downsized and watermarked images into the build/post slug directory
      • if a .jpg if found with the same slug as the parent dir, the post will be a special photo post
    • anything else in the same directory will be copies to build/post slug
  • send webmentions via https://telegraph.p3k.io/

/
├── about.html -> will be copied
├── category-1
│   ├── article-1 -> slug
│   │   └── index.md -> content file
│   │   └── extra-file.mp4 -> will be copied
│   │   └── 1509233601-domaincomentrytitle.md -> comment
│   ├── fancy-photo -> slug of photo post
│   │   └── index.md -> content
│   │   └── fancy-photo.jpg -> to downsize, watermark, get EXIF

Special features:

  • complete microformats2 and schema.org markup in templates
  • has light/dark theme, dark by default, but supports experimental prefers-color-scheme media query
  • generates 3 special PHP files:
    • search - uses and SQLite DB which is populated by Python on build
    • fallback - 404 handler to do redirects/gones, gets populated with an array of both
    • micropub - a micropub endpoint that accepts micropub content and puts the incoming payload into a json file, nothing else

Why GPL

Because I want believe.