Compare commits
29 Commits
d37bbfce38
...
main
Author | SHA1 | Date | |
---|---|---|---|
8230f0cb10 | |||
ecfb422394 | |||
bd4863bea9 | |||
ab2acbc7e2 | |||
e8ce333184 | |||
cb3148202d | |||
b1b7dd1ebd | |||
abd1e47f3a | |||
67129a184c | |||
dbe8da7f48 | |||
5f5dfbb4ce | |||
18a5b41afc | |||
f4ef0a5a2f | |||
4c5d682efa | |||
825aaf3214 | |||
24444d0a41 | |||
6cc31c6456 | |||
a23bf84710 | |||
075745f1c1 | |||
0907d476d8 | |||
f2526f6c62 | |||
817e0cb36d | |||
2865bd8e6d | |||
102371ff87 | |||
1541ae8c69 | |||
05179c864b | |||
28bd84cd87 | |||
8cb01f9318 | |||
5093d43413 |
@@ -6,17 +6,13 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
steps:
|
steps:
|
||||||
- run: apk add --no-cache nodejs
|
- run: apk add --no-cache nodejs rsync
|
||||||
|
- run: apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community hugo
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.17.0'
|
go-version: '>=1.17.0'
|
||||||
- run: go version
|
|
||||||
- run: apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community hugo
|
|
||||||
- run: hugo version
|
|
||||||
- run: hugo
|
- run: hugo
|
||||||
- run: ls -lah
|
|
||||||
- run: apk add rsync
|
|
||||||
- run: rsync -avz --delete ./public/ /sites/tsol/
|
- run: rsync -avz --delete ./public/ /sites/tsol/
|
33
.gitignore
vendored
33
.gitignore
vendored
@@ -1,2 +1,31 @@
|
|||||||
public/
|
# Hugo's default build folder
|
||||||
.hugo_build.lock
|
/public/
|
||||||
|
|
||||||
|
# Hugo's data folder (optional, depends on your project)
|
||||||
|
/data/
|
||||||
|
|
||||||
|
# Hugo's cache folder
|
||||||
|
/cache/
|
||||||
|
|
||||||
|
# Hugo's content folder can have media, drafts or temporary files that you don't want to commit
|
||||||
|
/content/drafts/
|
||||||
|
/content/images/
|
||||||
|
/content/sections/
|
||||||
|
|
||||||
|
# OS generated files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# IDE or text editor files
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# Node.js and other dependencies
|
||||||
|
node_modules/
|
||||||
|
yarn.lock
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
|
# Temporary files
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
.hugo_build.lock
|
||||||
|
7
.gitmodules
vendored
7
.gitmodules
vendored
@@ -1,4 +1,3 @@
|
|||||||
[submodule "themes/hermit-v2"]
|
[submodule "themes/hugo-indieweb-starter"]
|
||||||
path = themes/hermit-v2
|
path = themes/hugo-indieweb-starter
|
||||||
url = https://github.com/1bl4z3r/hermit-V2
|
url = https://git.thesatelliteoflove.com/phil/hugo-indieweb-starter.git
|
||||||
branch = main
|
|
||||||
|
109
content/articles/add-a-json-feed-to-any-hugo-site.md
Normal file
109
content/articles/add-a-json-feed-to-any-hugo-site.md
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
---
|
||||||
|
title: "Add a Json Feed to Any Hugo Site"
|
||||||
|
aliases: ["/posts/add-a-json-feed-to-any-hugo-site"]
|
||||||
|
date: 2024-12-27T20:13:26-07:00
|
||||||
|
draft: false
|
||||||
|
toc: false
|
||||||
|
description: "I fought with Hugo to add a JSON Feed so you don't have to #hugo #posse"
|
||||||
|
images:
|
||||||
|
tags:
|
||||||
|
- posse
|
||||||
|
- hugo
|
||||||
|
---
|
||||||
|
|
||||||
|
Super quick post tonight as a precursor to a post that I am working on about me adopting a "Post Once Syndicate Everywhere" ([POSSE](https://indieweb.org/POSSE)) strategy for my content.
|
||||||
|
|
||||||
|
I just spent way too long wrestling with Hugo (which runs this site) to add a [JSON Feed](https://www.jsonfeed.org/) compatible feed so that I can more reliably publish updates to this blog to the Fediverse/Threads/Bluesky and discovered that, ultimately, it is actually really simple. So I decided t document here in case anyone else needs a hand.
|
||||||
|
|
||||||
|
1. Add the following to your hugo.toml file
|
||||||
|
|
||||||
|
```
|
||||||
|
[outputFormats.jsonfeed]
|
||||||
|
mediaType = "application/json"
|
||||||
|
baseName = "feed"
|
||||||
|
rel = "alternate"
|
||||||
|
isPlainText = true
|
||||||
|
|
||||||
|
[outputs]
|
||||||
|
home = ["html", "jsonfeed", "rss"]
|
||||||
|
section = ["html", "jsonfeed", "rss"]
|
||||||
|
```
|
||||||
|
|
||||||
|
This creates the JSON Feed output format and adds the outputs to both "Home" and each section (for example, Posts).
|
||||||
|
|
||||||
|
2. In the root of your project (no need to mess with the theme if you are using one) make sure you have a layouts folder, and a _default folder inside of it (so layouts/_default)
|
||||||
|
|
||||||
|
3. In the layouts/_default directory create list.jsonfeed.json and copy the following into it:
|
||||||
|
|
||||||
|
```
|
||||||
|
{{- $pctx := . -}}
|
||||||
|
{{- if .IsHome -}}{{ $pctx = site }}{{- end -}}
|
||||||
|
{{- $pages := slice -}}
|
||||||
|
{{- if or $.IsHome $.IsSection -}}
|
||||||
|
{{- $pages = $pctx.RegularPages -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $pages = $pctx.Pages -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $limit := site.Config.Services.RSS.Limit -}}
|
||||||
|
{{- if ge $limit 1 -}}
|
||||||
|
{{- $pages = $pages | first $limit -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $title := "" }}
|
||||||
|
{{- if eq .Title .Site.Title }}
|
||||||
|
{{- $title = .Site.Title }}
|
||||||
|
{{- else }}
|
||||||
|
{{- with .Title }}
|
||||||
|
{{- $title = print . " on "}}
|
||||||
|
{{- end }}
|
||||||
|
{{- $title = print $title .Site.Title }}
|
||||||
|
{{- end }}
|
||||||
|
{
|
||||||
|
"version": "https://jsonfeed.org/version/1.1",
|
||||||
|
"title": {{ $title | jsonify }},
|
||||||
|
"home_page_url": {{ .Permalink | jsonify }},
|
||||||
|
{{- with .OutputFormats.Get "jsonfeed" }}
|
||||||
|
"feed_url": {{ .Permalink | jsonify }},
|
||||||
|
{{- end }}
|
||||||
|
{{- if (or .Site.Params.author .Site.Params.author_url) }}
|
||||||
|
"authors": [{
|
||||||
|
{{- if .Site.Params.author }}
|
||||||
|
"name": {{ .Site.Params.author | jsonify }},
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Site.Params.author_url }}
|
||||||
|
"url": {{ .Site.Params.author_url | jsonify }}
|
||||||
|
{{- end }}
|
||||||
|
}],
|
||||||
|
{{- end }}
|
||||||
|
{{- if $pages }}
|
||||||
|
"items": [
|
||||||
|
{{- range $index, $element := $pages }}
|
||||||
|
{{- with $element }}
|
||||||
|
{{- if $index }},{{end}} {
|
||||||
|
"title": {{ .Title | jsonify }},
|
||||||
|
"id": {{ .Permalink | jsonify }},
|
||||||
|
"tags": ["{{ delimit .Params.tags "," }}"]
|
||||||
|
"url": {{ .Permalink | jsonify }},
|
||||||
|
{{- if .Site.Params.showFullTextinJSONFeed }}
|
||||||
|
"summary": {{ with .Description }}{{ . | jsonify }}{{ else }}{{ .Summary | jsonify }}{{ end -}},
|
||||||
|
"content_html": {{ .Content | jsonify }},
|
||||||
|
{{- else }}
|
||||||
|
"content_text": {{ with .Description }}{{ . | jsonify }}{{ else }}{{ .Summary | jsonify }}{{ end -}},
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Params.cover.image }}
|
||||||
|
{{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
|
||||||
|
{{- if $cover }}
|
||||||
|
"image": {{ (path.Join .RelPermalink $cover) | absURL | jsonify }},
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
"date_published": {{ .Date.Format "2006-01-02T15:04:05Z07:00" | jsonify }}
|
||||||
|
}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
]
|
||||||
|
{{ end }}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
This lets Hugo know how to format these feeds.
|
||||||
|
|
||||||
|
|
||||||
|
... And that's it! You can check out my JSON feed at https://thesatelliteoflove.com/posts/feed/json
|
@@ -1,9 +1,11 @@
|
|||||||
---
|
---
|
||||||
title: "What I am self hosting - November 2024 edition"
|
title: "What I am self hosting - November 2024 edition"
|
||||||
|
aliases: ["/posts/add-a-json-feed-to-any-hugo-site"]
|
||||||
date: 2024-11-17T16:23:59-07:00
|
date: 2024-11-17T16:23:59-07:00
|
||||||
draft: false
|
draft: false
|
||||||
toc: false
|
toc: false
|
||||||
images:
|
images:
|
||||||
|
description: "A quick update on my selfhosting stack as of November 2024 #selfhosting"
|
||||||
tags:
|
tags:
|
||||||
- selfhosting
|
- selfhosting
|
||||||
---
|
---
|
6
content/notes/20250108234551.md
Normal file
6
content/notes/20250108234551.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
date: "2025-01-08"
|
||||||
|
type: "notes"
|
||||||
|
---
|
||||||
|
|
||||||
|
test note
|
6
content/notes/20250108234637.md
Normal file
6
content/notes/20250108234637.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
date: "2025-01-08"
|
||||||
|
type: "notes"
|
||||||
|
---
|
||||||
|
|
||||||
|
yet another test note
|
5
content/notes/_index.md
Normal file
5
content/notes/_index.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: "Notes"
|
||||||
|
type: "notes"
|
||||||
|
outputs: ["HTML", "jsonfeed"]
|
||||||
|
---
|
6
content/notes/note1.md
Normal file
6
content/notes/note1.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
date: "2025-01-07"
|
||||||
|
type: "notes"
|
||||||
|
---
|
||||||
|
|
||||||
|
This is a quick thought or observation without a title. #Microblogging
|
6
content/notes/note2.md
Normal file
6
content/notes/note2.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
date: "2025-01-07"
|
||||||
|
type: "notes"
|
||||||
|
---
|
||||||
|
|
||||||
|
This is another quick thought or observation without a title. #Microblogging
|
8
content/photos/pika.md
Normal file
8
content/photos/pika.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
title: "Sunset at the Beach"
|
||||||
|
date: "2025-01-07"
|
||||||
|
type: "photos"
|
||||||
|
image: "/images/IMG_0704-1.jpeg"
|
||||||
|
---
|
||||||
|
|
||||||
|
Captured this beautiful sunset while walking along the beach. 🌅
|
139
hugo.toml
139
hugo.toml
@@ -1,126 +1,49 @@
|
|||||||
# THIS IS AN EXAMPLE ON HOW YOU SHOULD CONFIGURE YOUR hugo.toml
|
|
||||||
# See this hugo.toml in action at https://github.com/1bl4z3r/hermit-V2/blob/staging/hugo.toml
|
|
||||||
# Example Site is Staging branch, acessible at https://github.com/1bl4z3r/hermit-V2/tree/staging
|
|
||||||
# To see what each config does, refer to https://1bl4z3r.github.io/hermit-V2/en/posts/explaining-configs/
|
|
||||||
# Open Issue or Pull Request at https://github.com/1bl4z3r/hermit-V2
|
|
||||||
|
|
||||||
baseURL = "https://thesatelliteoflove.com"
|
baseURL = "https://thesatelliteoflove.com"
|
||||||
# defaultContentLanguage = "en"
|
theme = "hugo-indieweb-starter"
|
||||||
# defaultContentLanguageInSubdir = true
|
|
||||||
theme = "hermit-v2"
|
|
||||||
|
|
||||||
#[languages]
|
|
||||||
# [languages.en]
|
|
||||||
# title = 'CHANGE ME'
|
|
||||||
# [languages.en.params]
|
|
||||||
# homeSubtitle = "CHANGE ME"
|
|
||||||
# weight = 1
|
|
||||||
# [languages.fr]
|
|
||||||
# title = 'CHANGE ME(FR)'
|
|
||||||
# [languages.fr.params]
|
|
||||||
# homeSubtitle = "CHANGE ME"
|
|
||||||
# weight = 2
|
|
||||||
# [languages.it]
|
|
||||||
# title = 'CHANGE ME(IT)'
|
|
||||||
# [languages.it.params]
|
|
||||||
# homeSubtitle = "CHANGE ME"
|
|
||||||
# weight = 3
|
|
||||||
|
|
||||||
languageCode = "en-us"
|
languageCode = "en-us"
|
||||||
|
|
||||||
title = "The Satellite of Love"
|
title = "The Satellite of Love"
|
||||||
# enableGitInfo = true
|
pygmentsCodefences = true
|
||||||
|
pygmentsUseClasses = true
|
||||||
pygmentsCodefences = true
|
|
||||||
pygmentsUseClasses = true
|
|
||||||
#hasCJKLanguage = true
|
|
||||||
|
|
||||||
rssLimit = 10
|
rssLimit = 10
|
||||||
|
paginate = 10
|
||||||
|
|
||||||
copyright = "The Satellite of Love"
|
copyright = "The Satellite of Love"
|
||||||
enableEmoji = true
|
enableEmoji = true
|
||||||
|
|
||||||
#[services]
|
|
||||||
# [services.disqus]
|
|
||||||
# shortname = ''
|
|
||||||
# [services.googleAnalytics]
|
|
||||||
# id = ''
|
|
||||||
|
|
||||||
[frontmatter]
|
[frontmatter]
|
||||||
date = ["date", "publishDate", "lastmod"]
|
date = ["date", "publishDate", "lastmod"]
|
||||||
lastmod = ["lastmod", ":git", "date", "publishDate"]
|
lastmod = ["lastmod", ":git", "date", "publishDate"]
|
||||||
publishDate = ["publishDate", "date"]
|
publishDate = ["publishDate", "date"]
|
||||||
expiryDate = ["expiryDate"]
|
|
||||||
|
|
||||||
|
|
||||||
# [params.author]
|
|
||||||
# name = "Phil Skents"
|
|
||||||
# about = "Assitant janitor of The Satellite of Love"
|
|
||||||
|
|
||||||
[blackfriday]
|
|
||||||
# hrefTargetBlank = true
|
|
||||||
# noreferrerLinks = true
|
|
||||||
# nofollowLinks = true
|
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
tag = "tags"
|
tag = "tags"
|
||||||
# Categories are disabled by default.
|
|
||||||
# category = "categories"
|
|
||||||
|
|
||||||
# Enable to get proper Mathjax support
|
[params.author]
|
||||||
#[markup]
|
name = "Phil Skents"
|
||||||
# [markup.goldmark]
|
url = "https://thesatelliteoflove.com"
|
||||||
# [markup.goldmark.extensions]
|
email = "phil@thesatelliteoflove.com" # Optional: Use if contact info is public
|
||||||
# [markup.goldmark.extensions.passthrough]
|
about = "Web tinkerer, IndieWeb enthusiast, and janitor of the Satellite of Love."
|
||||||
# enable = true
|
avatar = "static/images/author-avatar.png" # Optional: Path to an avatar image
|
||||||
# [markup.goldmark.extensions.passthrough.delimiters]
|
mastodon = "https://social.thesatelliteoflove.com/users/phil"
|
||||||
# block = [['\[', '\]'], ['$$', '$$']]
|
|
||||||
# inline = [['\(', '\)']]
|
|
||||||
|
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
dateform = "Jan 2, 2006"
|
# Basic site metadata
|
||||||
dateformShort = "Jan 2"
|
homeSubtitle = "Phil's IndieWeb Experiments"
|
||||||
dateformNum = "2006-01-02"
|
footerCopyright = "The Satellite of Love"
|
||||||
dateformNumTime = "2006-01-02 15:04 -0700"
|
|
||||||
|
|
||||||
# description = "CHANGE ME SITE DESCRIPTION"
|
|
||||||
# images = [""]
|
|
||||||
themeColor = "#494f5c"
|
themeColor = "#494f5c"
|
||||||
|
|
||||||
#homeSubtitle = "CHANGE ME HOME SUBTITLE"
|
# IndieWeb Features
|
||||||
footerCopyright = "The Satellite of Love"
|
enableWebmentions = true # To toggle webmention support
|
||||||
# footerHideThemeName = false
|
enableMicropub = true # Enable Micropub endpoint functionality
|
||||||
# bgImg = ""
|
syndicationTargets = ["Mastodon", "Bluesky", "GitHub"] # Supported syndication
|
||||||
# gitUrl = "https://github.com/1bl4z3r/hermit-V2/tree/staging"
|
|
||||||
|
|
||||||
justifyContent = false
|
# Post options
|
||||||
|
dateform = "Jan 2, 2006"
|
||||||
|
dateformShort = "Jan 2"
|
||||||
|
dateformNum = "2006-01-02"
|
||||||
|
|
||||||
relatedPosts = true
|
# Optional social links
|
||||||
code_copy_button = true
|
|
||||||
|
|
||||||
homeSubtitlePrinter = true
|
|
||||||
scrollToTop = true
|
|
||||||
global_mathjax = false
|
|
||||||
readTime = true
|
|
||||||
readTimeSeparator = "-"
|
|
||||||
# legacyLayout = false
|
|
||||||
shareSocial = true
|
|
||||||
# googleTagManager = "GTM-XXXXXXXX"
|
|
||||||
# tagSymbol = "#"
|
|
||||||
# categorySymbol = "⊲"
|
|
||||||
# pinned = "Pinned Posts"
|
|
||||||
# pinnedSVGname = "pin"
|
|
||||||
# descriptionInPosts= true
|
|
||||||
# initialPublish = "Initally Posted on: "
|
|
||||||
# human = ["single","posts"]
|
|
||||||
# noIndex = false
|
|
||||||
# denyRobots = "noindex, nofollow, noarchive"
|
|
||||||
# allowRobots = "index, follow"
|
|
||||||
# siteNoIndex = false
|
|
||||||
# noIndexPages = ["404 Page not found"]
|
|
||||||
# usesAnimation = true
|
|
||||||
|
|
||||||
[[params.socialLinks]]
|
[[params.socialLinks]]
|
||||||
name = "mastodon"
|
name = "mastodon"
|
||||||
url = "https://social.thesatelliteoflove.com/users/phil"
|
url = "https://social.thesatelliteoflove.com/users/phil"
|
||||||
@@ -134,7 +57,6 @@ expiryDate = ["expiryDate"]
|
|||||||
url = "https://bsky.app/profile/mrwhiskers.bsky.social"
|
url = "https://bsky.app/profile/mrwhiskers.bsky.social"
|
||||||
|
|
||||||
[menu]
|
[menu]
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "Posts"
|
name = "Posts"
|
||||||
url = "posts/"
|
url = "posts/"
|
||||||
@@ -143,4 +65,15 @@ expiryDate = ["expiryDate"]
|
|||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "About"
|
name = "About"
|
||||||
url = "about/"
|
url = "about/"
|
||||||
weight = 20
|
weight = 20
|
||||||
|
|
||||||
|
[outputFormats.jsonfeed]
|
||||||
|
mediaType = "application/json"
|
||||||
|
baseName = "feed"
|
||||||
|
rel = "alternate"
|
||||||
|
isPlainText = true
|
||||||
|
|
||||||
|
[outputs]
|
||||||
|
home = ["html", "jsonfeed", "rss"]
|
||||||
|
section = ["html", "jsonfeed", "rss"]
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
|||||||
{"Target":"/ananke/css/main.min.css","MediaType":"text/css","Data":{}}
|
|
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
|||||||
{"Target":"css/style.min.b76ead157e389aea5cb7034b075218ad50e5d36d55d53c29fbdd1358ef8e4629.css","MediaType":"text/css","Data":{"Integrity":"sha256-t26tFX44mupctwNLB1IYrVDl021V1Twp+90TWO+ORik="}}
|
|
0
static/feeds/.index
Normal file
0
static/feeds/.index
Normal file
BIN
static/images/IMG_0704-1.jpeg
Normal file
BIN
static/images/IMG_0704-1.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 419 KiB |
Submodule themes/hermit-v2 deleted from 881a5b145d
1
themes/hugo-indieweb-starter
Submodule
1
themes/hugo-indieweb-starter
Submodule
Submodule themes/hugo-indieweb-starter added at 5f5c7ecc76
Reference in New Issue
Block a user