commit 93d3e32ef108d1f1f47da98f121975dfa2dc9da6 Author: John Bowdre Date: Sun Mar 3 16:34:46 2024 -0600 initial commit diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..2b59c15 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +#!/usr/bin/env direnv +use flake . + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aecf0c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.certificates/ +/.direnv/ +/public/ \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9dd6bad --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1709237383, + "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..14e0a75 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + description = "gemsite build environment"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + pkgs = import nixpkgs { system = "x86_64-linux"; }; + gempost = pkgs.rustPlatform.buildRustPackage rec { + pname = "gempost"; + version = "v0.3.0"; + + src = pkgs.fetchFromGitHub { + owner = "justlark"; + repo = pname; + rev = version; + hash = "sha256-T6CP1blKXik4AzkgNJakrJyZDYoCIU5yaxjDvK3p01U="; + }; + cargoHash = "sha256-jG/G/gmaCGpqXeRQX4IqV/Gv6i/yYUpoTC0f7fMs4pQ="; + }; + in + { + devShells.x86_64-linux.default = pkgs.mkShell { + packages = with pkgs; [ + agate + gempost + ]; + }; + }; +} + diff --git a/gemlog/hello-world.gmi b/gemlog/hello-world.gmi new file mode 100644 index 0000000..e3a82d4 --- /dev/null +++ b/gemlog/hello-world.gmi @@ -0,0 +1,3 @@ +Hello, world! + +This is an example gemlog post. diff --git a/gemlog/hello-world.yaml b/gemlog/hello-world.yaml new file mode 100644 index 0000000..1589353 --- /dev/null +++ b/gemlog/hello-world.yaml @@ -0,0 +1,15 @@ +# +# This is an example of a YAML sidecar metadata file. +# + +# A universally unique URI that will never change. We recommend using a UUID. +id: "urn:uuid:f82846da-b32a-4e77-9ce1-4be99da99292" + +# The title of your post. +title: "Hello World" + +# When your post was originally published. +published: "2024-03-03T15:44:28-06:00" + +# When your post was last updated. +updated: "2024-03-03T15:44:28-06:00" diff --git a/gempost.yaml b/gempost.yaml new file mode 100644 index 0000000..b623d8a --- /dev/null +++ b/gempost.yaml @@ -0,0 +1,54 @@ +# The directory to generate the capsule at (required). +public_dir: "./public/" + +# The directory for static assets that are copied to the generated capsule +# verbatim (required). +static_dir: "./static/" + +# The directory for gemtext gemlog posts and their sidecar metadata files +# (required). +posts_dir: "./gemlog/" + +# The path of the Tera template used to generate the gemlog index page +# (required). +index_template_file: "./templates/index.tera" + +# The path of the Tera template used to generate each gemlog post page +# (required). +post_template_file: "./templates/post.tera" + +# A Tera template which specifies the URL path for posts (required). +# +# This template has access to the following variables: +# - `year`: The four-digit year of publication, if a publication date was provided +# - `month`: The two-digit month of publication, if a publication date was provided +# - `day`: The two-digit day of publication, if a publication date was provided +# - `slug`: The name of the gemtext source file, sans file extension +# +# Docs for the Tera templating language: +# https://keats.github.io/tera/docs/#templates +post_path: "/gemlog/{{ year }}-{{ month }}-{{ day }}-{{ slug }}.gmi" + +# The URL path of the index page for your gemlog (required). +index_path: "/gemlog/index.gmi" + +# The URL path to serve your capsule's Atom feed at (required). +feed_path: "/gemlog/atom.xml" + +# The title of your gemlog (required). +title: "John's Capsule" + +# The gemini:// URL of your capsule's homepage (required). +url: "gemini://gem.jbowdre.lol" + +# A subtitle for your gemlog (optional). +subtitle: "My personal gemlog about cool stuff" + +# The copyright and licensing information for your gemlog (optional). +rights: "CC BY-SA" + +# The primary author of your gemlog (optional). +author: + name: "John Bowdre" # Required + email: "jbowdre@omg.lol" # Optional + uri: "gemini://gem.jbowdre.lol" # Optional diff --git a/static/index.gmi b/static/index.gmi new file mode 100644 index 0000000..3eac4b4 --- /dev/null +++ b/static/index.gmi @@ -0,0 +1,5 @@ +# John's Capsule + +This is an example homepage for your capsule. + +=> /gemlog Gemlog diff --git a/templates/index.tera b/templates/index.tera new file mode 100644 index 0000000..d1095e4 --- /dev/null +++ b/templates/index.tera @@ -0,0 +1,20 @@ +{# + This is an example of a Tera template for your gemlog's index page. + + This example formats your index page in the standard gemsub format that + Gemini clients can subscribe to. Note that gempost already generates an Atom + feed that clients should be able to subscribe to. + + Here is the documentation for the gemsub format: + https://geminiprotocol.net/docs/companion/subscription.gmi +#}# {{ feed.title }} + +{% if feed.subtitle -%} +## {{ feed.subtitle }} + +{% endif -%} + +{% for entry in feed.entries -%} +=> {{ entry.url }} {{ entry.updated | date(format="%Y-%m-%d") }} - {{ entry.title }} +{% endfor %} +=> {{ feed.feed_url }} Atom feed diff --git a/templates/post.tera b/templates/post.tera new file mode 100644 index 0000000..d6f51bb --- /dev/null +++ b/templates/post.tera @@ -0,0 +1,8 @@ +{# + This is an example of a Tera template for each individual post. + + This is a minimal example that just adds a header with the title from the + sidecar YAML metadata file. +#}# {{ entry.title }} + +{{ entry.body }}