Prefer hugo for blog.wpcarro.dev
Instead of creating my own static website generator, I'm trying Hugo. Huge is a newer alternative to Jekyll. So far, I like what I see. - Ignoring /blog/public since this is where `huge -D` generates the static assets. - Using a TailwindCSS theme. - Creating a dumby post about Emacs to test deployments. - Deleting all Common Lisp and Nix code that powered my previous, half-baked blog.
This commit is contained in:
parent
2e0ad09a02
commit
d206a2812f
9 changed files with 46 additions and 104 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -32,3 +32,4 @@ __pycache__
|
|||
node_modules/
|
||||
/configs/.config/fish/config.fish
|
||||
/configs/.config/fish/fish_variables
|
||||
/blog/public/
|
||||
|
|
6
blog/archetypes/default.md
Normal file
6
blog/archetypes/default.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
draft: true
|
||||
---
|
||||
|
25
blog/config.toml
Normal file
25
blog/config.toml
Normal file
|
@ -0,0 +1,25 @@
|
|||
baseURL = "https://blog.wpcarro.dev"
|
||||
disqusShortname = "wpcarro"
|
||||
languageCode = "en-us"
|
||||
title = "blog.wpcarro.dev"
|
||||
theme = "tailwind"
|
||||
pygmentsCodeFences = true
|
||||
pygmentsUseClasses = true
|
||||
|
||||
[taxonomies]
|
||||
tag = "tags"
|
||||
|
||||
[permalinks]
|
||||
posts = "/posts/:year/:month/:title/"
|
||||
|
||||
[params]
|
||||
author = "William Carroll"
|
||||
description = "Loosely structured streams of consciousness"
|
||||
tagline = "Loosely structured streams of consciousness"
|
||||
|
||||
[languages]
|
||||
[languages.en]
|
||||
contentDir = "content/english"
|
||||
languageCode = "en-us"
|
||||
languageName = "English"
|
||||
weight = 1
|
14
blog/content/english/my-first-post.md
Normal file
14
blog/content/english/my-first-post.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
title: "Professional Emacs"
|
||||
date: 2020-03-09T11:50:28Z
|
||||
draft: false
|
||||
---
|
||||
# Professional Emacs
|
||||
|
||||
Some people don't think it's possible. Is it possible?
|
||||
|
||||
## Elisp
|
||||
|
||||
```elisp
|
||||
(defvar answer 'yes)
|
||||
```
|
|
@ -1,21 +0,0 @@
|
|||
{ pkgs, depot, briefcase, ... }:
|
||||
|
||||
let
|
||||
injections = pkgs.writeText "injections.lisp" ''
|
||||
(in-package #:server)
|
||||
(setq *path-to-posts* "${./posts}")
|
||||
(setq *pandoc-bin* "${pkgs.pandoc}/bin/pandoc")
|
||||
(setq *html-template* "${./src/index.html}")
|
||||
'';
|
||||
in depot.nix.buildLisp.program {
|
||||
name = "server";
|
||||
deps = with depot.third_party.lisp; with briefcase.third_party.lisp; [
|
||||
hunchentoot
|
||||
cl-arrows
|
||||
cl-ppcre
|
||||
];
|
||||
srcs = [
|
||||
./src/server.lisp
|
||||
injections
|
||||
];
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{ pkgs, briefcase, ... }:
|
||||
|
||||
pkgs.dockerTools.buildLayeredImage {
|
||||
name = "blog";
|
||||
tag = "latest";
|
||||
config.ExposedPorts = {
|
||||
"4242" = {};
|
||||
};
|
||||
config.Cmd = [ "${briefcase.blog}/bin/server" ];
|
||||
maxLayers = 120;
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
# Testing
|
||||
|
||||
The goal here is to be able to write markdown files and have a server that can
|
||||
render the markdown into HTML and serve them to the clients.
|
|
@ -1,14 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="wpcarro.dev | blog" />
|
||||
<title>wpcarro.dev | blog</title>
|
||||
<script data-ad-client="ca-pub-6018268443649487" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
{{ blog }}
|
||||
</body>
|
||||
</html>
|
|
@ -1,54 +0,0 @@
|
|||
(in-package #:cl-user)
|
||||
(defpackage #:server
|
||||
(:documentation "Robot condemned to a life of admin work for my blog.")
|
||||
(:use #:cl)
|
||||
(:use #:cl-ppcre)
|
||||
(:import-from #:cl-arrows #:->>)
|
||||
(:export :main))
|
||||
(in-package #:server)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Nix-injected dependencies
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar *path-to-posts* "/tmp/"
|
||||
"File path pointing to the posts directory.")
|
||||
|
||||
(defvar *pandoc-bin* "/usr/bin/pandoc")
|
||||
|
||||
(defvar *html-template* "./index.html"
|
||||
"The path to the HTML template used for the blog posts.")
|
||||
|
||||
(defvar *posts* (uiop:directory-files *path-to-posts*)
|
||||
"List of the paths to the blog posts.")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Library
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; TODO: Support properly indenting the output from pandoc to nest within the
|
||||
;; template. Or just use a proper templating library.
|
||||
(defun render-post (path)
|
||||
"Render the markdown file stored at PATH to HTML using pandoc."
|
||||
(cl-ppcre:regex-replace-all
|
||||
"{{ blog }}"
|
||||
(uiop:read-file-string *html-template*)
|
||||
(uiop:run-program (list *pandoc-bin* path "--to" "html") :output :string)))
|
||||
|
||||
(hunchentoot:define-easy-handler
|
||||
(get-latest :uri "/latest") ()
|
||||
(render-post (concatenate 'string *path-to-posts* "/" "test.md")))
|
||||
|
||||
(hunchentoot:define-easy-handler
|
||||
(get-posts :uri "/posts") ()
|
||||
"Working!")
|
||||
|
||||
(defun main ()
|
||||
"This is the main entrypoint for our application."
|
||||
(hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242))
|
||||
(print "Listing on port 4242...")
|
||||
(sb-thread:join-thread
|
||||
(find-if (lambda (th)
|
||||
(string= (sb-thread:thread-name th)
|
||||
"hunchentoot-listener-*:4242"))
|
||||
(sb-thread:list-all-threads))))
|
Loading…
Reference in a new issue