4 ms·
Personally, I used Jekyll for a while before switching to a simple Makefile based approach. I write everything in Markdown, which gets compiled via Pandoc, conc
by charlesdaniels 9y ago
Personally, I used Jekyll for a while before switching to a simple Makefile based approach. I write everything in Markdown, which gets compiled via Pandoc, concatenated with a header and footer. I also recently started using pygments to generate colorized inline HTML to syntax highlight code blocks.
If anyone is interested, I wrote up the process[1], although I have not updated the post with the pygments script yet.
[1] - http://cdaniels.net//2017-11-22_make-static-site.html http://cdaniels.net//2017-11-22_make-static-site.html
- bArray 9y agoI do something similar, except with a `bash` script and hand writing the titles + dates. I thought about automating that, but work in different time zones so prefer to choose. One thing I might have of interest to you is a small DNT (DoNotTrack) JS file [1] and some CSS that adds some visual markdown features to the page after the fact [2]. P.S. Your output looks like it's missing `<HTML>` and other tags? And how are you getting automated code colour highlighting? [1] http://coffeespace.org.uk/dnt.js http://coffeespace.org.uk/dnt.js [2] http://coffeespace.org.uk/style.css http://coffeespace.org.uk/style.css
- charlesdaniels 9y agoSince I may not have time to update my article for a while, here is a link to the script[1]. I am unclear on your dnt script? What does it do? I don't have any facilities on my site to track users at all as it stands. I will probably be mooching parts of your CSS though, thanks for posting it here! Edit: you are correct, I seem to have forgotten to include <HTML> tags... I should probably fix that. [1] https://gist.github.com/charlesdaniels/ac5fa6e3e77aef5ff5c85fa2d95e9fba https://gist.github.com/charlesdaniels/ac5fa6e3e77aef5ff5c85...
- bArray 9y ago>Since I may not have time to update my article for a while, here is a link to the script[1]. Thank you. I was hoping you had figured out how to get it going in `pandoc`, tried it myself to no avail but just assumed I had done something wrong. >I am unclear on your dnt script? What does it do? I don't have any facilities on my site to track users at all as it stands. No, but I can imagine it useful if you did want to put a relevant YouTube video or Tweet embedded in, but wanted to respect DNT. It's worked pretty well so far. >I will probably be mooching parts of your CSS though, thanks for posting it here! No problem! Some parts to make the font size a little better for mobiles too at the top :) >Edit: you are correct, I seem to have forgotten to include <HTML> tags... I should probably fix that. Yeah, not a massive deal but who knows, could break something in the future!
- sigil 9y agoFellow Jekyll refugee here. I also switched to the Makefile SSG approach for the much faster incremental rebuilds. Parallel speedup with make -j is also nice. My SSG is called tinysite [1] [2]. Templates are jinja2. Posts are written in markdown with Pygments highlighting for fenced code blocks. Posts also have JSON frontmatter which can #include other JSON data files, and this is where it gets Make-y: all affected pages get rebuilt when a data file changes with the help of a `gcc -M`-style file dependency scanner. I use these frontmatter "data includes" for site wide metadata and for data driven pages like post indexes. There's also a dev server so you can quickly preview changes. The biggest frustration I have with the Makefile + interpreted language approach is the slow startup time of interpreters these days. When every page requires a new interpreter process it really starts to add up, if not in incremental builds, then definitely in full rebuilds of larger sites. Some quick tests I did recently of `time $INTERPRETER -[c|e] ""`: node 6 ... 70ms ruby 2 ... 58ms python 2 ... 27ms perl 5 ... 5ms sh ... 3ms Perl compares quite favorably here, but I just can't bring myself to go back to it. I wish these other interpreters would get their startup time act together! I guess this is an argument for go / Hugo? [1] https://github.com/acg/tinysite https://github.com/acg/tinysite [2] https://github.com/acg/alangrow.com https://github.com/acg/alangrow.com
- dfox 9y agoMy (nowadays totally non-updated) website is built on similar approach with make+python (but with xml+xslt, which was the technology of the day in mid-00s) and the CPython's startup time was always issue even to the point that the incremental rebuilds essentially didn't make much sense (but writing the machinery was at least a fun experiment).
- charlesdaniels 9y agoThis is very impressive, and definitely more elegant than my approach. Getting make -j for free was definitely a major plus; before I started using a Python script to syntax highlight inline code, my site built in under a second... now it takes around 3. I am honestly surprised to find Python is so slow in terms of start up time. This made me wonder if it was generating / searching for .pyc files, but a quick test revealed this is not the case: sh-4.3$ ls nop.py nop.sh sh-4.3$ hexdump -C nop.py sh-4.3$ hexdump -C nop.sh sh-4.3$ time python3 nop.py real 0m0.064s user 0m0.048s sys 0m0.016s sh-4.3$ time sh nop.sh real 0m0.002s user 0m0.002s sys 0m0.000s sh-4.3$ python3 -m compileall . Listing '.'... Compiling './nop.py'... sh-4.3$ time python3 nop.py real 0m0.062s user 0m0.057s sys 0m0.004s sh-4.3$ python3 __pycache__/nop.cpython-35.pyc sh-4.3$ time python3 __pycache__/nop.cpython-35.pyc real 0m0.060s user 0m0.048s sys 0m0.012s I would add that shell can be surprisingly fast for certain tasks when used correctly. It's very easy to write slow (ba)sh code though, so most shell scripts wind up being fairly non-performent. Edit: formatting.