Compare commits

..

15 Commits

Author SHA1 Message Date
6f1c4dd841 adding lume cms
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-11 18:46:06 -04:00
b7f6def94d 💄 ui touches
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-11 15:50:39 -04:00
df332d5b2b 💥 giving lume / deno a try
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-23 15:37:43 -04:00
19f785af09 ⬆️ update deps
Some checks failed
continuous-integration/drone/push Build is failing
2024-04-09 17:36:46 -04:00
e98ab33314 🗃️ switch to mariadb 2024-04-09 17:36:28 -04:00
04a9b99d05 🔨 add flake
Some checks failed
continuous-integration/drone/push Build is failing
2024-04-09 17:35:56 -04:00
45fcc085ad 👷 publish via drone to ipfs
All checks were successful
continuous-integration/drone/push Build is passing
2023-02-09 22:35:37 -05:00
06e57e6c93 ⬆️ eleventy 2.0 2023-02-09 22:07:46 -05:00
f457a7f8d2 🐛 ghost url != api_url 2022-12-08 21:49:48 -05:00
49a806203f add relativePath filter
Closes #2
2022-12-08 18:07:41 -05:00
6be49f3d75 🐛 fix docker typo 2022-12-05 20:43:17 -05:00
d656a40e82 🐳 docker-compose updates 2022-12-05 17:58:19 -05:00
12273058f6 add dateString filter 2022-11-14 21:05:03 -05:00
0853782914 clean up feeds 2022-11-13 20:24:03 -05:00
2592e84d07 💄 simple layout 2022-11-11 23:26:39 -05:00
25 changed files with 1890 additions and 10794 deletions

22
.drone.yml Normal file
View File

@ -0,0 +1,22 @@
kind: pipeline
type: docker
name: default
steps:
- name: build
image: denoland/deno
commands:
- deno task build
- name: publish
image: walkah.dev/walkah/drone-ipfs-cluster
settings:
path: /drone/src/_site
domain: walkah.blog
cluster_host: /ip4/100.95.167.126/tcp/9094
cluster_user: walkah
cluster_password:
from_secret: IPFS_CLUSTER_PASSWORD
cluster_args: -f
cf_email: walkah@walkah.net
cf_apikey:
from_secret: CLOUDFLARE_APIKEY

View File

@ -1,54 +0,0 @@
require("dotenv").config();
const GhostContentAPI = require("@tryghost/content-api");
const pluginNavigation = require("@11ty/eleventy-navigation");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const localImages = require('eleventy-plugin-local-images');
const api = new GhostContentAPI({
url: process.env.GHOST_API_URL,
key: process.env.GHOST_CONTENT_API_KEY,
version: "v3.0"
});
const stripDomain = url => {
return url.replace(process.env.GHOST_API_URL, "");
};
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addPlugin(localImages, {
distPath: '_site',
assetPath: '/assets/images',
selector: 'img',
verbose: false
});
eleventyConfig.addCollection("posts", async function (collection) {
collection = await api.posts
.browse({
include: "tags,authors",
limit: "all",
})
.catch((err) => {
console.error(err);
});
collection.forEach((post) => {
post.url = stripDomain(post.url);
post.primary_author.url = stripDomain(post.primary_author.url);
// Convert publish date into a Date object
post.date = new Date(post.published_at);
});
// Bring featured post to the top of the list
collection.sort((post, nextPost) => nextPost.featured - post.featured);
return collection;
});
}

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

6
.gitignore vendored
View File

@ -1,3 +1,5 @@
_site
_cache
.DS_Store
/node_modules /node_modules
/_site /.direnv
/.env

23
_cms.ts Normal file
View File

@ -0,0 +1,23 @@
import lumeCMS from "lume/cms/mod.ts";
const cms = lumeCMS();
cms.collection(
"posts: Blog posts",
"src:posts/*.md",
[
"title: text",
"date: datetime",
"image: file",
"image_alt: text",
"image_caption: text",
{
name: "content",
type: "markdown",
label: "Content",
},
],
);
cms.upload("images", "src:images");
export default cms;

39
_config.ts Normal file
View File

@ -0,0 +1,39 @@
import lume from "lume/mod.ts";
import date from "lume/plugins/date.ts";
import feed from "lume/plugins/feed.ts";
import metas from "lume/plugins/metas.ts";
import nunjucks from "lume/plugins/nunjucks.ts";
import postcss from "lume/plugins/postcss.ts";
import relativeUrls from "lume/plugins/relative_urls.ts";
import tailwindcss from "lume/plugins/tailwindcss.ts";
import terser from "lume/plugins/terser.ts";
import tailwindConfig from "./tailwind.config.js";
const site = lume();
site.copy("images");
site.use(date());
site.use(feed({
output: ["/feed.rss", "/feed.json"],
info: {
title: "=site.title",
description: "=site.description",
},
items: {
title: "=title",
description: "=excerpt",
},
query: "type=post",
}));
site.use(metas());
site.use(nunjucks());
site.use(tailwindcss({
options: tailwindConfig,
}));
site.use(postcss());
site.use(relativeUrls());
site.use(terser());
export default site;

6
_data.yml Normal file
View File

@ -0,0 +1,6 @@
metas:
site: walkah.blog
description: James Walker has a blog
title: "=title"
image: "=image"
lang: en

View File

@ -1,19 +0,0 @@
{
"title": "walkah",
"url": "https://walkah.blog/",
"description": "It's a new blog, just like the old blog.",
"feed": {
"filename": "feed.xml",
"path": "/feed.xml",
"id": "https://walkah.blog/"
},
"jsonfeed": {
"path": "/feed.json",
"url": "https://walkah.blog/feed.json"
},
"author": {
"name": "James Walker",
"email": "walkah@walkah.net",
"url": "https://walkah.net/"
}
}

View File

@ -1,18 +1,25 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="{{ it.lang }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title or metadata.title }}</title> <title>{{ title or metas.site }} - James Walker</title>
<meta name="description" content="{{ description or metadata.description }}"> <meta name="description" content="{{ description or metas.description }}">
<link rel="stylesheet" href="{{ '/css/style.css' | url }}"> <link rel="stylesheet" href="/css/style.css">
<link rel="alternate" href="{{ metadata.feed.path | url }}" type="application/atom+xml" title="{{ metadata.title }}"> <link rel="alternate" href="https://walkah.blog/feed.rss" type="application/rss+xml">
<link rel="alternate" href="{{ metadata.jsonfeed.path | url }}" type="application/json" title="{{ metadata.title }}"> <link rel="alternate" href="https://walkah.blog/feed.json" type="application/json">
</head> </head>
<body class="bg-white text-gray-900 dark:bg-gray-900 dark:text-gray-100"> <body class="bg-white text-gray-900 dark:bg-gray-900 dark:text-gray-100">
<div class="container max-w-2xl mb-24 mt-8 mx-auto"> <div class="container max-w-2xl mb-24 mt-8 mx-auto">
<div class="px-5 md:px-8"> <div class="px-5 md:px-8">
<main id="main"> <header class="flex flex-row not-prose my-8">
<div rel="author" class="p-author h-card basis-1/2">
<a href="/">
<img class="u-photo w-8 inline-block" src="/images/walkah-avatar.png"> walkah
</a>
</div>
</header>
<main id="main" class="prose lg:prose-lg dark:prose-invert">
{% block content %} {% block content %}
{% endblock content %} {% endblock content %}
</main> </main>

View File

@ -1,25 +1,29 @@
{% extends 'layouts/default.njk' %} {% extends 'layouts/default.njk' %}
{% set title = post.title %}
{% set codeinjection_head = post.codeinjection_head %}
{% set codeinjection_foot = post.codeinjection_foot %}
{% block content %} {% block content %}
<article class="h-entry prose lg:prose-lg dark:prose-invert" role="article"> <article class="h-entry prose lg:prose-lg dark:prose-invert" role="article">
<header> <header>
<h1 class="p-name">{{ title }}</h1> <h1 class="p-name">{{ title }}</h1>
<time class="dt-published" datetime={{ post.published_at }} pubdate><a class="u-url text-gray-500 text-sm" href={{ post.url }}>{{ post.published_at }}</a></time>
</header> </header>
{% if post.feature_image %} {% if image %}
<figure class="md:-mx-12"> <figure class="md:-mx-12">
<img class="u-featured rounded-md shadow-md w-full" src="{{ post.feature_image }}" alt="{{ title }}"> <img class="u-featured rounded-md shadow-md w-full" src="{{ image }}" alt="{{ image_alt }}">
{% if image_caption %}
<figcaption>
<cite>{{ image_caption }}</cite>
</figcaption>
{% endif %}
</figure> </figure>
{% endif %} {% endif %}
<section class="e-content load-external-scripts"> <section class="e-content" load-external-scripts>
{{ content | safe }} {{ content | safe }}
</section> </section>
<footer class="flex flex-row not-prose"> <footer class="flex flex-row not-prose">
<div class="basis-1/2">
<time class="dt-published" datetime="{{ date | date('ATOM') }}" pubdate>
<a class="u-url text-gray-500 text-sm" href="{{ post.url }}">{{ date | date }}</a>
</time>
</div>
</footer> </footer>
</article> </article>
{% endblock %} {% endblock %}

16
deno.json Normal file
View File

@ -0,0 +1,16 @@
{
"imports": {
"lume/": "https://deno.land/x/lume@v2.2.0/",
"lume/cms/": "https://cdn.jsdelivr.net/gh/lumeland/cms@0.4.1/"
},
"tasks": {
"lume": "echo \"import 'lume/cli.ts'\" | deno run -A -",
"build": "deno task lume",
"serve": "LUME_DRAFTS=true deno task lume -s"
},
"compilerOptions": {
"types": [
"lume/types.ts"
]
}
}

1619
deno.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
version: "3"
services:
ghost:
image: ghost:5-alpine
ports:
- 2368:2368
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: password
database__connection__database: ghost
url: http://localhost:2368
restart: unless-stopped
volumes:
- ghost:/var/lib/ghost/content
db:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
volumes:
ghost:

View File

@ -1,28 +0,0 @@
---
permalink: "{{ metadata.feed.path | url }}"
eleventyExcludeFromCollections: true
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ metadata.title }}</title>
<subtitle>{{ metadata.feed.subtitle }}</subtitle>
{% set absoluteUrl %}{{ metadata.feed.path | url | absoluteUrl(metadata.url) }}{% endset %}
<link href="{{ absoluteUrl }}" rel="self"/>
<link href="{{ metadata.url }}"/>
<updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
<id>{{ metadata.feed.id }}</id>
<author>
<name>{{ metadata.author.name }}</name>
<email>{{ metadata.author.email }}</email>
</author>
{%- for post in collections.posts | reverse %}
{% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %}
<entry>
<title>{{ post.title }}</title>
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | rssDate }}</updated>
<id>{{ absolutePostUrl }}</id>
<content type="html">{{ post.html | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
</entry>
{%- endfor %}
</feed>

View File

@ -1,30 +0,0 @@
---
permalink: "{{ metadata.jsonfeed.path | url }}"
eleventyExcludeFromCollections: true
---
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ metadata.title }}",
"home_page_url": "{{ metadata.url }}",
"feed_url": "{{ metadata.jsonfeed.url }}",
"description": "{{ metadata.description }}",
"author": {
"name": "{{ metadata.author.name }}",
"url": "{{ metadata.author.url }}"
},
"items": [
{%- for post in collections.posts | reverse %}
{%- set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset -%}
{
"id": "{{ absolutePostUrl }}",
"url": "{{ absolutePostUrl }}",
"title": "{{ post.title }}",
"content_html": {% if post.html %}{{ post.html | dump | safe }}{% else %}""{% endif %},
"date_published": "{{ post.date | rssDate }}"
}
{%- if not loop.last -%}
,
{%- endif -%}
{%- endfor %}
]
}

78
flake.lock generated Normal file
View File

@ -0,0 +1,78 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1718089647,
"narHash": "sha256-COO4Xk2EzlZ3x9KCiJildlAA6cYDSPlnY8ms7pKl2Iw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f7207adcc68d9cafa29e3cd252a18743ae512c6a",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

26
flake.nix Normal file
View File

@ -0,0 +1,26 @@
{
description = "walkah's blog";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
name = "blog";
buildInputs = with pkgs; [ deno ];
};
}
);
}

BIN
images/walkah-avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

View File

@ -6,9 +6,8 @@ pagination:
--- ---
{% extends 'layouts/default.njk' %} {% extends 'layouts/default.njk' %}
{% block content %} {% block content %}
{% set postslist = collections.posts %} {% set postslist = search.pages("type=post") %}
<section class="h-feed">
<section class="h-feed prose dark:prose-invert">
{% for post in postslist %} {% for post in postslist %}
<article class="h-entry"> <article class="h-entry">
<h2 class="p-name"> <h2 class="p-name">
@ -17,6 +16,9 @@ pagination:
<div class="e-content"> <div class="e-content">
{{ post.excerpt | safe }} {{ post.excerpt | safe }}
</div> </div>
<time class="dt-published" datetime={{ post.date | date }} pubdate>
<a class="u-url text-gray-500 text-sm" href={{ post.url }}>{{ post.date | date }}</a>
</time>
</article> </article>
{% endfor %} {% endfor %}
</section> </section>

10556
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +0,0 @@
{
"name": "walkah.blog",
"version": "1.0.0",
"description": "The new blog. Just like the old blog.",
"scripts": {
"build": "run-s clean prod css:prod",
"clean": "rimraf ./_site",
"css:prod": "tailwindcss -i ./css/style.css -o ./_site/css/style.css --minify",
"css:dev": "tailwindcss -i ./css/style.css -o ./_site/css/style.css --watch",
"dev": "eleventy --serve --watch",
"prod": "eleventy",
"start": "run-p clean css:dev dev"
},
"author": {
"name": "James Walker",
"email": "walkah@walkah.net",
"url": "https://walkah.net/"
},
"license": "MIT",
"devDependencies": {
"@11ty/eleventy": "^1.0.1",
"@11ty/eleventy-navigation": "^0.3.3",
"@11ty/eleventy-plugin-rss": "^1.0.9",
"@tailwindcss/typography": "^0.5.2",
"@tryghost/content-api": "^1.9.4",
"dotenv": "^16.0.1",
"eleventy-plugin-local-images": "^0.4.1",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"tailwindcss": "^3.0.24"
}
}

5
posts/_data.yml Normal file
View File

@ -0,0 +1,5 @@
layout: layouts/post.njk
type: post
metas:
title: "=title"

View File

@ -1,11 +0,0 @@
---
pagination:
data: collections.posts
size: 1
alias: post
addAllPagesToCollections: true
layout: 'layouts/post.njk'
permalink: '{{ post.url }}'
---
{{ post.html | safe if post.html else "Post content not found" }}

View File

@ -1,11 +1,11 @@
module.exports = { import typography from "npm:@tailwindcss/typography";
export default {
mode: "jit", mode: "jit",
darkMode: "media", darkMode: "media",
content: ["./**/*.{html,md,njk}"], content: ["./**/*.{html,md,njk}"],
theme: { theme: {
extend: {}, extend: {},
}, },
plugins: [ plugins: [typography],
require('@tailwindcss/typography'), };
],
}