https://github.com/rsdoiel/py_sitetools
A proof of concept wrapping mkpage with front matter supporting a boutique CMS in less than 80 lines of Python.
https://github.com/rsdoiel/py_sitetools
Last synced: 2 months ago
JSON representation
A proof of concept wrapping mkpage with front matter supporting a boutique CMS in less than 80 lines of Python.
- Host: GitHub
- URL: https://github.com/rsdoiel/py_sitetools
- Owner: rsdoiel
- License: other
- Created: 2019-06-02T00:18:35.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2020-06-27T00:50:26.000Z (almost 5 years ago)
- Last Synced: 2025-02-16T07:13:19.925Z (4 months ago)
- Language: Python
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py_sitetools
This Python 3 package wraps Caltech Library's
[mkpage](https://github.com/caltechlibrary/mkpage) (v0.0.26)
command line tools for building light weight boutique static
site generators.## Example boutique static site generator
At less than 80 lines of Python [boutique.py](boutique.py)
is an example of how easy it is to make a content management
system building on
[py_dataset](https://github.com/caltechlibrary/py_dataset),
and py_sitetools.Boutique reads a "docs" folder for Markdown files, ingests them
into a dataset collection called "boutique.ds". Each markdown
file is expected to have a JSON front matter section with the
following fields--+ id (any unique string)
+ title (title of page)
+ creators (an array of strings of author names)
+ byline (a single string used as a byline)
+ pub_date (date of publication)
+ output the filename and path to render to relative to the site rootOn ingest the front matter is separate from the markdown document
creating a record structure like```json
{
"metadata": { ... },
"content" : PATH_TO_MARKDOWN_DOC
}
```This will get saved in the dataset collection named "boutique.ds".
After page ingest the collection content is iterated over creating
the described pages in the "htdocs" folder identified in the
_boutique.py_ program as **site_dir**. The layout of the website
is idependent of the contents of the docs directory. Each page
identifies explicitly where it will be published to.The whole Python 3 script for _boutique.py_ is about 80 lines, the whole
**py_sitetools** is under 200 (including boutque.py).