Add post titles and blurbs

This commit is contained in:
Catalin Constantin Mititiuc 2025-05-12 19:18:45 -07:00
parent 80c8a9cab3
commit 8e5df87224
7 changed files with 26 additions and 16 deletions

View File

@ -1,5 +1,7 @@
{ {
id: "open-an-iex-shell-from-an-elixir-script" id: "open-an-iex-shell-from-an-elixir-script"
title: "Open An IEx Shell From An Elixir Script"
blurb: "We can run an Elixir script with either the <code>elixir</code> or the <code>iex</code> command. Both will execute the code, but the second command opens an interactive IEx shell afterward. What if, we won't know until runtime whether we want a shell or not? How can we start an IEx session even when we use <code>elixir</code>, instead of <code>iex</code>, to run our script?"
} }
--- ---

View File

@ -1,5 +1,7 @@
{ {
id: "start-erlangs-dialyzer-with-gui-from-a-docker-container" id: "start-erlangs-dialyzer-with-gui-from-a-docker-container"
title: "Start Erlang's Dialyzer With GUI From A Docker Container"
blurb: "Everything in OTP is command-line driven, so using containers during development has been without issue. But, Dialyzer, Erlang's static analysis tool, actually has a Graphical User Interface. How can we still use Dialyzer and its GUI even though Elixir is running inside a container?"
} }
--- ---

View File

@ -1,5 +1,6 @@
{ {
id: "fix-distortion-introduced-when-transforming-multiview-projections-to-isometric" id: "fix-distortion-introduced-when-transforming-multiview-projections-to-isometric"
blurb: "One thing we learned from a week of trying to make isometric vector drawings."
} }
--- ---

View File

@ -1,5 +1,7 @@
{ {
id: "deploy-elixir-generated-html-with-docker-on-digitalocean" id: "deploy-elixir-generated-html-with-docker-on-digitalocean"
title: "Deploy Elixir-Generated HTML With Docker On DigitalOcean"
blurb: "This is a simple proof of concept where we create a boilerplate HTML file with Elixir, containerize our build process with Docker, and deploy our markup live with DigitalOcean's hosting service."
} }
--- ---

View File

@ -1,5 +1,7 @@
{ {
id: "test-mix-task-file-modify" id: "test-mix-task-file-modify"
title: "Temporary Directories For Testing Mix Tasks That Modify Files"
blurb: "Writing a test for a simple Mix task gets surprisingly complex. Application environment variables, temporary test directories, and IO capture are all involved."
} }
--- ---

View File

@ -1,5 +1,7 @@
{ {
id: "build-static-website-generator-part-1" id: "build-static-website-generator-part-1"
title: "Build A Static-Website Generator With Elixir, Part 1"
blurb: "We take the first steps in designing and implementing the \"world's simplest static-website generator\". Building on tools and knowledge we acquired previously, and utilizing an incremental and iterative development process, we go through the entire software life-cycle from creating the initial project files to deploying to production. We spare nothing, from spelling out every command, to ensuring application integrity with tests, and even updating the README file. Grab a drink and some snacks, and dive right in!"
} }
--- ---

View File

@ -41,7 +41,7 @@
-- </a> -- </a>
-- </section> -- </section>
date = require "date" date = require "date"
date! -- date!
-- return { -- return {
-- format: "markdown" -- format: "markdown"
-- title: "My Site's Title" -- title: "My Site's Title"
@ -54,27 +54,26 @@ path = require "sitegen.path"
moon = require("moon") moon = require("moon")
common = require("sitegen.common") common = require("sitegen.common")
get_date = (str) -> str extract_date = (source) -> string.match path.filename(source), "%d+%-%d%d%-%d%d"
format_date = (str) -> date(str)\fmt "%b %d, %Y"
publish_date = (path) -> format_date extract_date path
html -> html ->
posts = [{ posts = [{
id: p.meta.id id: p.meta.id
target: p.meta.target tgt: p.meta.target
source: p.source src: p.source
title: p.meta.title or p.meta.id
blurb: p.meta.blurb
} for _, p in pairs page.site.pages when p.meta.template == "blog"] } for _, p in pairs page.site.pages when p.meta.template == "blog"]
-- require("moon").p [p.meta for _, p in pairs page.site.pages]
table.sort posts, (a, b) -> a.src > b.src
[tag["section"] { [tag["section"] {
tag["h3"] { tag["a"] { href: p.target .. ".html", p.id }} tag["h3"] { tag["a"] { href: p.tgt .. ".html", p.title }}
tag["time"] { tag["time"] { publish_date p.src }
-- p.source "—" .. if p.blurb then " #{p.blurb}" else ""
-- tostring(date(2011, 11, 26)) tag["a"] { class: "read-post-link", href: p.tgt .. ".html", "Read post →"}
-- one = string.match(path.filename(p.source), "%d+%-%d%d%-%d%d%-")
-- r = string.gsub(one, "%-", " ")
-- r
get_date string.match(path.filename(p.source), "%d+%-%d%d%-%d%d")
-- common.slugify path.filename(p.target)
}
"— blurb here"
tag["a"] { class: "read-post-link", href: p.target .. ".html", "Read post →"}
} for _, p in ipairs posts] } for _, p in ipairs posts]