1
0
mirror of https://github.com/danbee/danbarber.me.hugo.git synced 2025-03-04 08:59:18 +00:00

Add feeds

This commit is contained in:
Daniel Barber 2019-10-25 17:16:38 -04:00
parent d4472710ec
commit c6fbd1425a
14 changed files with 171 additions and 8 deletions

View File

@ -17,3 +17,11 @@ photos = "/:year/:month/:day/:title"
resampleFilter = "lanczos"
quality = 75
anchor = "smart"
[outputFormats.jsonfeed]
mediaType = "application/json"
isPlainText = true
[outputs]
home = ["html", "jsonfeed", "rss"]
section = ["html", "jsonfeed", "rss"]

View File

@ -7,7 +7,7 @@ categories:
- iphone
- iphone-4
layout: post
image: blog/iphone-4/IMG_0035.jpg
image: IMG_0035.jpg
---
<figure>
@ -35,3 +35,4 @@ The OS is very nice indeed. It certainly seems like Apple have really sweated al

View File

@ -7,7 +7,7 @@ categories:
- iphone
- iphone-4
layout: post
image: blog/iphone-4-revisited/IMG_0052.jpg
image: IMG_0052.jpg
---
<figure>
@ -38,3 +38,4 @@ The original iPhone had a headphone jack that was recessed into the body, which

View File

@ -9,7 +9,7 @@ categories:
- iphone
- iphone-4
layout: post
image: blog/apple-in-ear-headphones/IMG_0053.jpg
image: IMG_0053.jpg
---
<figure>
@ -40,3 +40,4 @@ Overall I'm very pleased with these headphones. Definitely recommended if you li

View File

@ -7,7 +7,7 @@ categories:
- steve-jobs
- visionaries
layout: post
image: blog/steve-jobs/steve-jobs.jpg
image: steve-jobs.jpg
---
<figure>
@ -22,3 +22,4 @@ Thanks Steve.

View File

@ -4,7 +4,7 @@ date: '2014-02-08T00:00:00+00:00'
layout: post
categories:
- blog
image: blog/zx81/154120730_9cb06dbc98_o.jpg
image: 154120730_9cb06dbc98_o.jpg
---
<figure>
@ -37,3 +37,5 @@ Despite all of its shortcomings, the ZX81 was an enjoyable computer to tinker wi

View File

@ -4,7 +4,7 @@ date: '2014-04-29T07:28:00+00:00'
layout: post
categories:
- blog
image: blog/zx-spectrum-plus-2/5364873704_0fe55f7e3e_o.jpg
image: 5364873704_0fe55f7e3e_o.jpg
---
<figure>
@ -70,3 +70,4 @@ Long live the ZX Spectrum!

View File

@ -7,7 +7,7 @@ categories:
- hardware
- keyboards
date: '2018-01-21T17:38:21+00:00'
image: blog/building-a-keyboard/DSCF7141.jpg
image: DSCF7141.jpg
---
<figure>
@ -191,3 +191,4 @@ reprinted keycaps. My current keymap is

View File

@ -8,7 +8,7 @@ categories:
- elixir
- games
date: '2018-08-10T00:00:00+00:00'
image: blog/chess-and-recursion-part-1/escher-chess.jpg
image: escher-chess.jpg
---
<style>
@ -297,3 +297,4 @@ blog](https://robots.thoughtbot.com/chess-and-recursion-part-1).*

29
layouts/index.json Normal file
View File

@ -0,0 +1,29 @@
{{ $imageSize := default "600x600" }}
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ .Site.Title }}",
"home_page_url": "{{ .Site.BaseURL }}",
"feed_url": "{{ .Permalink}}",
"items": [
{{ range $i, $e := first 40 .Site.RegularPages }}
{{ if $i }}, {{ end }}
{
"id": "{{ .Permalink }}",
"title": "{{ .Title }}",
{{ if .Params.image }} {{ $src := .Page.Resources.GetMatch (.Params.image) }}
{{ $image := $src.Fit $imageSize }}
"image": "{{ $image.RelPermalink }}",
{{ end }}
{{ if .Params.categories }}
"categories": ["{{ delimit .Params.categories "," }}"],
{{ end }}
"content_text": {{ .Summary | jsonify }},
"url": "{{ .Permalink }}",
"date_published": "{{ .Date }}"
}
{{ end }}
]
}

21
layouts/section/blog.json Normal file
View File

@ -0,0 +1,21 @@
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ .Site.Title }}",
"home_page_url": "{{ .Site.BaseURL }}",
"feed_url": "{{ .Permalink}}",
"items": [
{{ range $i, $e := first 20 .Pages }}
{{ if $i }}, {{ end }}
{
"id": "{{ .Permalink }}",
"title": "{{ .Title }}",
"content_html": {{ .Content | jsonify }},
"url": "{{ .Permalink }}",
"date_published": "{{ .Date }}"{{ if .Params.categories }},
"categories": ["{{ delimit .Params.categories "\", \"" }}"]
{{ end }}
}
{{ end }}
]
}

33
layouts/section/blog.xml Normal file
View File

@ -0,0 +1,33 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link href="{{ .Permalink }}" />
<id>{{ .Permalink }}"</id>
<generator uri="https://gohugo.io">Hugo</generator>
{{ with .Site.Author.email }}
<author>
<name>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</name>
</author>
{{end}}
{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>
{{end}}
{{ if not .Date.IsZero }}
<updated>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</updated>
{{ end }}
{{ range first 20 .Pages }}
<entry>
<title>{{ .Title }}</title>
<link href="{{ .Permalink }}" />
<updated>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</updated>
<id>{{ .Permalink }}</id>
<content type="html">{{ .Content | html }}</content>
</entry>
{{ end }}
</feed>

View File

@ -0,0 +1,30 @@
{{ $imageSize := default "600x600" }}
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ .Site.Title }}",
"home_page_url": "{{ .Site.BaseURL }}",
"feed_url": "{{ .Permalink}}",
"items": [
{{ range $i, $e := first 20 .Pages }}
{{ if $i }}, {{ end }}
{
"id": "{{ .Permalink }}",
"title": "{{ .Title }}",
{{ if .Params.image }}
{{ $src := .Page.Resources.GetMatch (.Params.image) }}
{{ $image := $src.Fit $imageSize }}
"image": "{{ $image.RelPermalink }}",
{{ end }}
{{ if .Params.categories }}
"categories": ["{{ delimit .Params.categories "," }}"],
{{ end }}
"content_html": {{ .Content | jsonify }},
"url": "{{ .Permalink }}",
"date_published": "{{ .Date }}"
}
{{ end }}
]
}

View File

@ -0,0 +1,33 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link href="{{ .Permalink }}" />
<id>{{ .Permalink }}"</id>
<generator uri="https://gohugo.io">Hugo</generator>
{{ with .Site.Author.email }}
<author>
<name>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</name>
</author>
{{end}}
{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>
{{end}}
{{ if not .Date.IsZero }}
<updated>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</updated>
{{ end }}
{{ range first 20 .Pages }}
<entry>
<title>{{ .Title }}</title>
<link href="{{ .Permalink }}" />
<updated>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</updated>
<id>{{ .Permalink }}</id>
<content type="html">{{ .Content | html }}</content>
</entry>
{{ end }}
</feed>