How I made this site!
Keeping it real ðŸ˜
I didn't really put much effort into making this site.
I wanted to make something entirely from scractch, and I wanted to
avoid learning front-end as much as possible (I suck at designing
pages).
Thankfully, the tools I already knew could be leveraged to make it
happen!
Technicals 🤓
A few of years ago, I found out I could export emacs's org-mode
files to HTML. So, I wrote an index in org-mode, with a few clever
babel code blocks! It's all bash!!
- How I get my blog posts listed on the front page:
echo "<ul>" for file in blog/*.org; do title=$(awk -F ':' '/^[[:space:]]*#\+TITLE:/ { gsub(/^[ \t]+|[ \t]+$/, "", $2); print $2; exit }' "$file") date=$(awk -F ':' '/^[[:space:]]*#\+DATE:/ { gsub(/^[ \t]+|[ \t]+$/, "", $2); print $2; exit }' "$file") base=$(basename "$file" .org) echo "<li><a href=\"blog/$base.html\">$title</a> <span style=\"color: gray; font-size: 0.9em\">($date)</span></li>" done Echo "</Ul>"
- How I get my most recent pushes on the front page:
curl -s "https://api.github.com/users/brjorgen/repos?sort=pushed" \ | jq -r '.[0:5] | map("<li><a href=\"" + .html_url + "\"><strong>" + .full_name + "</strong></a><br/><small>" + (.description // "No description") + "</small></li>") | join("\n")' \ | sed '1i\ <ul>' | sed '$a\ </ul>'
And using org-publish I set up publishing the entire org project to
the server hosting my site!
- Configuration for org-publish
(setq org-publish-project-alist '(("my-site" :base-directory "~/src/the-site" :base-extension "org" :publishing-directory "/scp:[redacted@redacted]:[redacted]" :recursive t :publishing-function org-html-publish-to-html :html-head "<link rel=\"stylesheet\" href=\"style.css\">" :with-author nil :with-creator nil :with-toc nil :html-preamble nil :html-postamble nil) ("static" :base-directory "~/src/the-site" :base-extension "css\\|js\\|png\\|jpg\\|gif" :publishing-directory "/scp:[redacted@redacted]:[redacted]" :recursive t :publishing-function org-publish-attachment) ("full-site" :components ("my-site" "static"))))
I literally just write the pages locally, Run the babel code
blocks, export to HTML locally for review, and when satisfied, I
just hit publish with
M-x org-publish RET full-site RET
and… voila. That's it. Thanks for reading!