Series and tags (#74)

* initial support for tags and series

* tagging support

* oops

* Update main.go
This commit is contained in:
Cadey Ratio 2019-09-12 18:49:03 -04:00 committed by GitHub
parent 2007492c49
commit 7a302eb69b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 231 additions and 7 deletions

View File

@ -1,6 +1,10 @@
--- ---
title: "OVE-20190623-0001" title: "OVE-20190623-0001"
date: 2019-06-24 date: 2019-06-24
tags:
- v
- security
- release
--- ---
# OVE-20190623-0001 # OVE-20190623-0001

View File

@ -2,6 +2,8 @@
title: A Letter to Those That Bullied Me title: A Letter to Those That Bullied Me
date: 2018-06-16 date: 2018-06-16
for: Elizabeth for: Elizabeth
tags:
- offmychest
--- ---
# A Letter to Those Who Bullied Me # A Letter to Those Who Bullied Me

View File

@ -1,7 +1,10 @@
--- ---
title: My Experience with Atom as A Vim User title: My Experience with Atom as A Vim User
date: 2014-11-18 date: 2014-11-18
from: medium series: medium-archive
tags:
- atom
- vim
--- ---
My Experience with Atom as A Vim User My Experience with Atom as A Vim User

View File

@ -2,6 +2,8 @@
title: The Beautiful in the Ugly title: The Beautiful in the Ugly
date: 2018-04-23 date: 2018-04-23
for: Silver for: Silver
tags:
- shell
--- ---
# The Beautiful in the Ugly # The Beautiful in the Ugly
@ -85,4 +87,4 @@ function deploy {
} }
$* $*
``` ```

View File

@ -1,6 +1,9 @@
--- ---
title: Web Application Development with Beego title: Web Application Development with Beego
date: 2014-11-28 date: 2014-11-28
tags:
- go
- beego
--- ---
Web Application Development with Beego Web Application Development with Beego

View File

@ -1,6 +1,7 @@
--- ---
title: "Blind Men and an Elephant" title: "Blind Men and an Elephant"
date: 2018-11-29 date: 2018-11-29
series: conlangs
--- ---
# Blind Men and an Elephant # Blind Men and an Elephant

View File

@ -1,6 +1,10 @@
--- ---
title: How I Converted my Brain fMRI to a 3D Model title: How I Converted my Brain fMRI to a 3D Model
date: 2019-08-23 date: 2019-08-23
series: howto
tags:
- python
- blender
--- ---
# How I Converted my Brain fMRI to a 3D Model # How I Converted my Brain fMRI to a 3D Model

View File

@ -1,6 +1,8 @@
--- ---
title: Advice to People Nurturing a Career in Computering title: Advice to People Nurturing a Career in Computering
date: 2019-06-18 date: 2019-06-18
tags:
- career
--- ---
# Advice to People Nurturing a Career in Computering # Advice to People Nurturing a Career in Computering

View File

@ -2,6 +2,7 @@
title: "Chaos Magick Debugging" title: "Chaos Magick Debugging"
date: 2018-11-13 date: 2018-11-13
thanks: CelestialBoon thanks: CelestialBoon
series: magick
--- ---
# Chaos Magick Debugging # Chaos Magick Debugging

View File

@ -1,6 +1,8 @@
--- ---
title: CinemaQuestria Orchestration title: CinemaQuestria Orchestration
date: 2015-03-13 date: 2015-03-13
tags:
- cinemaquestria
--- ---
CinemaQuestria Orchestration CinemaQuestria Orchestration

View File

@ -1,6 +1,8 @@
--- ---
title: Coding on an iPad title: Coding on an iPad
date: 2018-04-14 date: 2018-04-14
tags:
- ipad
--- ---
# Coding on an iPad # Coding on an iPad
@ -130,4 +132,4 @@ You just do thing and it does thing.
[texastic]: https://itunes.apple.com/us/app/textastic-code-editor-6/id1049254261?mt=8 [texastic]: https://itunes.apple.com/us/app/textastic-code-editor-6/id1049254261?mt=8
[workingcopy]: https://itunes.apple.com/us/app/working-copy/id896694807?mt=8 [workingcopy]: https://itunes.apple.com/us/app/working-copy/id896694807?mt=8
[workflow]: https://www.workflow.is [workflow]: https://www.workflow.is
[ceruleiscloud]: https://elliot.pro/blog/working-in-the-cloud.html [ceruleiscloud]: https://elliot.pro/blog/working-in-the-cloud.html

View File

@ -1,6 +1,8 @@
--- ---
title: Coming Out title: Coming Out
date: 2015-12-01 date: 2015-12-01
tags:
- personal
--- ---
Coming Out Coming Out

View File

@ -1,6 +1,9 @@
--- ---
title: "Crazy Experiment: Ship the Frontend as an asar document" title: "Crazy Experiment: Ship the Frontend as an asar document"
date: "2017-01-09" date: "2017-01-09"
tags:
- asar
- frontend
--- ---
Crazy Experiment: Ship the Frontend as an asar document Crazy Experiment: Ship the Frontend as an asar document

View File

@ -2,6 +2,9 @@
title: "Creator's Code" title: "Creator's Code"
author: Christine Dodrill author: Christine Dodrill
date: 2018-09-17 date: 2018-09-17
tags:
- release
- coc
--- ---
# [Creator's Code](https://github.com/Xe/creators-code) # [Creator's Code](https://github.com/Xe/creators-code)

View File

@ -1,6 +1,7 @@
--- ---
title: My Experience Cursing Out God title: My Experience Cursing Out God
date: 2018-11-21 date: 2018-11-21
series: dreams
--- ---
# My Experience Cursing Out God # My Experience Cursing Out God
@ -37,4 +38,4 @@ I was floored and must have amused Him, given that He started to chuckle: "Creat
He looked at his wrist as if He was looking at a watch, even though He was not wearing one. "Oh dear, it looks like it's time for you to wake up now. Remember Creator, no time but the present." He snapped His hands and then the volcano started to erupt. He looked at his wrist as if He was looking at a watch, even though He was not wearing one. "Oh dear, it looks like it's time for you to wake up now. Remember Creator, no time but the present." He snapped His hands and then the volcano started to erupt.
The world instantly snapped out of existence and I awoke in a sweat, my blankets evenly distributed in my room. The world instantly snapped out of existence and I awoke in a sweat, my blankets evenly distributed in my room.

View File

@ -2,6 +2,7 @@
title: Death title: Death
date: 2018-08-19 date: 2018-08-19
thanks: Sygma thanks: Sygma
series: magick
--- ---
# Death # Death

View File

@ -1,6 +1,8 @@
--- ---
title: "Deprecation Notice: Elemental-IRCd" title: "Deprecation Notice: Elemental-IRCd"
date: 2019-02-11 date: 2019-02-11
tags:
- release
--- ---
# Deprecation Notice: Elemental-IRCd # Deprecation Notice: Elemental-IRCd

View File

@ -1,6 +1,8 @@
--- ---
title: Instant Development Environments in Docker title: Instant Development Environments in Docker
date: 2014-10-24 date: 2014-10-24
tags:
- release
--- ---
Instant Development Environments in Docker Instant Development Environments in Docker

View File

@ -3,6 +3,9 @@ title: "Farewell Email - Heroku"
date: 2019-03-08 date: 2019-03-08
for: Herokai for: Herokai
subject: May our paths cross again subject: May our paths cross again
tags:
- personal
- heroku
--- ---
# Farewell Email - Heroku # Farewell Email - Heroku

View File

@ -3,6 +3,7 @@ title: Fear
date: 2018-07-24 date: 2018-07-24
thanks: CelestialBoon, no really this guy is amazing and doesn't get enough credit, I'm so grateful for him. thanks: CelestialBoon, no really this guy is amazing and doesn't get enough credit, I'm so grateful for him.
for: Twilight Sparkle for: Twilight Sparkle
series: stories
--- ---
# Fear # Fear

View File

@ -1,6 +1,10 @@
--- ---
title: FFI-ing Go from Nim for Fun and Profit title: FFI-ing Go from Nim for Fun and Profit
date: 2015-12-20 date: 2015-12-20
series: howto
tags:
- go
- nim
--- ---
FFI-ing Golang from Nim for Fun and Profit FFI-ing Golang from Nim for Fun and Profit

View File

@ -1,6 +1,7 @@
--- ---
title: A Formal Grammar of h title: A Formal Grammar of h
date: 2019-05-19 date: 2019-05-19
series: conlangs
--- ---
# A Formal Grammar of `h` # A Formal Grammar of `h`

View File

@ -1,6 +1,7 @@
--- ---
title: Getting Started with Go title: Getting Started with Go
date: 2015-01-28 date: 2015-01-28
series: howto
--- ---
Getting Started with Go Getting Started with Go

View File

@ -3,6 +3,7 @@ title: Gratitude
date: 2018-07-20 date: 2018-07-20
thanks: CelestialBoon thanks: CelestialBoon
for: Mother Aya for: Mother Aya
series: magick
--- ---
# Gratitude # Gratitude

View File

@ -1,6 +1,9 @@
--- ---
title: The h Programming Language title: The h Programming Language
date: 2019-06-30 date: 2019-06-30
tags:
- wasm
- release
--- ---
# The h Programming Language # The h Programming Language

View File

@ -1,6 +1,7 @@
--- ---
title: How does into Meditation title: How does into Meditation
date: 2017-12-10 date: 2017-12-10
series: when-then-zen
--- ---
# How does into Meditation # How does into Meditation

View File

@ -1,6 +1,10 @@
--- ---
title: How to Send Email with Nim title: How to Send Email with Nim
date: 2019-08-28 date: 2019-08-28
series: howto
tags:
- nim
- email
--- ---
# How to Send Email with Nim # How to Send Email with Nim

View File

@ -1,6 +1,7 @@
--- ---
title: How to Automate Discord Message Posting With Webhooks and Cron title: How to Automate Discord Message Posting With Webhooks and Cron
date: 2018-03-29 date: 2018-03-29
series: howto
--- ---
# How to Automate Discord Message Posting With Webhooks and Cron # How to Automate Discord Message Posting With Webhooks and Cron

View File

@ -1,6 +1,7 @@
--- ---
title: How to Use User Mode Linux title: How to Use User Mode Linux
date: 2019-07-07 date: 2019-07-07
series: howto
--- ---
# How to Use User Mode Linux # How to Use User Mode Linux

View File

@ -1,6 +1,7 @@
--- ---
title: "iPad Smart Keyboard: French Accents/Ligatures" title: "iPad Smart Keyboard: French Accents/Ligatures"
date: 2019-05-10 date: 2019-05-10
series: howto
--- ---
# iPad Smart Keyboard: French Accents/Ligatures # iPad Smart Keyboard: French Accents/Ligatures

View File

@ -1,6 +1,9 @@
--- ---
title: "Land 1: Syscalls & File I/O" title: "Land 1: Syscalls & File I/O"
date: 2018-06-18 date: 2018-06-18
series: olin
tags:
- wasm
--- ---
# Land 1: Syscalls & File I/O # Land 1: Syscalls & File I/O

View File

@ -2,6 +2,8 @@
title: Let it Snow title: Let it Snow
date: 2018-12-17 date: 2018-12-17
for: the lols for: the lols
tags:
- fluff
--- ---
# Let it Snow # Let it Snow

View File

@ -2,6 +2,8 @@
title: "Life Update - Montréal" title: "Life Update - Montréal"
date: "2019-05-16" date: "2019-05-16"
for: "Vic" for: "Vic"
tags:
- personal
--- ---
# Life Update - Montréal # Life Update - Montréal
@ -40,4 +42,4 @@ Something of note is that this is the first time I've moved without having to ge
Things are looking up for me. I'm really happy. My new job is great. The people I work with are great. I'm working towards French fluency (hopefully going to be writing blogposts in French by this time two years from now at most). Everything is looking up from here, and I'm so happy for it. Things are looking up for me. I'm really happy. My new job is great. The people I work with are great. I'm working towards French fluency (hopefully going to be writing blogposts in French by this time two years from now at most). Everything is looking up from here, and I'm so happy for it.
Can't wait to see what's next! Can't wait to see what's next!

View File

@ -2,6 +2,11 @@
title: Introducing Lokahi title: Introducing Lokahi
date: 2018-02-08 date: 2018-02-08
github_issue: https://github.com/Xe/lokahi/issues/15 github_issue: https://github.com/Xe/lokahi/issues/15
tags:
- hackweek
- release
- go
- monitoring
--- ---
# Introducing Lokahi # Introducing Lokahi

View File

@ -1,6 +1,10 @@
--- ---
title: MrBeast is Postmodern Gold title: MrBeast is Postmodern Gold
date: 2019-06-05 date: 2019-06-05
tags:
- mrbeast
- postmodern
- youtube
--- ---
Author's note: I've been going through a lot lately. This Monday I was in the emergency room after having a panic attack. I have a folder of writing in my notes that I use to help work off steam. I don't know why, but writing this article really helped me feel better. I can only hope it helps make your day feel better too. Author's note: I've been going through a lot lately. This Monday I was in the emergency room after having a panic attack. I have a folder of writing in my notes that I use to help work off steam. I don't know why, but writing this article really helped me feel better. I can only hope it helps make your day feel better too.

View File

@ -2,6 +2,7 @@
title: Narrative of Sickness title: Narrative of Sickness
date: 2018-08-13 date: 2018-08-13
for: awakening for: awakening
series: magick
--- ---
# Narrative of Sickness # Narrative of Sickness

View File

@ -1,6 +1,7 @@
--- ---
title: "Olin: 1: Why" title: "Olin: 1: Why"
date: 2018-09-01 date: 2018-09-01
series: olin
--- ---
# [Olin][olin]: 1: Why # [Olin][olin]: 1: Why

View File

@ -1,6 +1,7 @@
--- ---
title: "Olin: 2: The Future" title: "Olin: 2: The Future"
date: 2018-09-05 date: 2018-09-05
series: olin
--- ---
# [Olin](https://github.com/Xe/olin): 2: The Future # [Olin](https://github.com/Xe/olin): 2: The Future

View File

@ -2,6 +2,7 @@
title: "One Day" title: "One Day"
date: 2018-11-01 date: 2018-11-01
for: "Nicole" for: "Nicole"
series: stories
--- ---
# One Day # One Day
@ -24,4 +25,4 @@ It asked me "do that again", so I did. I did it more intensely than before someh
Probably the most significant part though was being told "I love you". Probably the most significant part though was being told "I love you".
I felt **loved**. I still do. I try to love others the way I am loved. I felt **loved**. I still do. I try to love others the way I am loved.

View File

@ -1,6 +1,7 @@
--- ---
title: The Saga of plt, Part 1 title: The Saga of plt, Part 1
date: 2015-02-14 date: 2015-02-14
series: plt
--- ---
The Saga of plt, Part 1 The Saga of plt, Part 1

View File

@ -1,6 +1,7 @@
--- ---
title: The Saga of plt, Part 2 title: The Saga of plt, Part 2
date: 2015-02-14 date: 2015-02-14
series: plt
--- ---
The Saga of plt, Part 2 The Saga of plt, Part 2

View File

@ -1,6 +1,7 @@
--- ---
title: "Instant Pot Quinoa Taco Bowls" title: "Instant Pot Quinoa Taco Bowls"
date: 2019-08-16 date: 2019-08-16
series: recipes
--- ---
# Instant Pot Quinoa Taco Bowls # Instant Pot Quinoa Taco Bowls

View File

@ -1,6 +1,9 @@
--- ---
title: "RSS Feed Generation" title: "RSS Feed Generation"
date: "2017-03-29" date: "2017-03-29"
tags:
- rss
- atom
--- ---
RSS Feed Generation RSS Feed Generation

View File

@ -1,6 +1,7 @@
--- ---
title: "Site to Site WireGuard: Part 1 - Names and Numbers" title: "Site to Site WireGuard: Part 1 - Names and Numbers"
date: "2019-04-02" date: "2019-04-02"
series: site-to-site-wireguard
--- ---
# Site to Site WireGuard: Part 1 - Names and Numbers # Site to Site WireGuard: Part 1 - Names and Numbers

View File

@ -1,6 +1,7 @@
--- ---
title: "Site to Site WireGuard: Part 2 - DNS" title: "Site to Site WireGuard: Part 2 - DNS"
date: 2019-04-07 date: 2019-04-07
series: site-to-site-wireguard
--- ---
# Site to Site WireGuard: Part 2 - DNS # Site to Site WireGuard: Part 2 - DNS

View File

@ -1,6 +1,7 @@
--- ---
title: "Site to Site WireGuard: Part 3 - Custom TLS Certificate Authority" title: "Site to Site WireGuard: Part 3 - Custom TLS Certificate Authority"
date: 2019-04-11 date: 2019-04-11
series: site-to-site-wireguard
--- ---
# Site to Site WireGuard: Part 3 - Custom TLS Certificate Authority # Site to Site WireGuard: Part 3 - Custom TLS Certificate Authority

View File

@ -1,6 +1,10 @@
--- ---
title: Sorting Time title: Sorting Time
date: 2018-08-26 date: 2018-08-26
tags:
- time
- javascript
- tale-of-woe
--- ---
# Sorting Time # Sorting Time

View File

@ -1,6 +1,7 @@
--- ---
title: Tarot for Hackers title: Tarot for Hackers
date: 2019-07-24 date: 2019-07-24
series: magick
--- ---
# Tarot for Hackers # Tarot for Hackers

View File

@ -1,6 +1,7 @@
--- ---
title: "TempleOS: 1 - Installation" title: "TempleOS: 1 - Installation"
date: 2019-05-20 date: 2019-05-20
series: templeos
--- ---
# TempleOS: 1 - Installation # TempleOS: 1 - Installation

View File

@ -1,6 +1,7 @@
--- ---
title: "Ten Thousand Laughs" title: "Ten Thousand Laughs"
date: "2018-12-01" date: "2018-12-01"
series: conlangs
--- ---
# Ten Thousand Laughs # Ten Thousand Laughs

View File

@ -1,6 +1,11 @@
--- ---
title: The Cult of Kubernetes title: The Cult of Kubernetes
date: 2019-09-07 date: 2019-09-07
series: howto
tags:
- kubernetes
- digitalocean
- githubactions
--- ---
# The Cult of Kubernetes # The Cult of Kubernetes

View File

@ -1,6 +1,7 @@
--- ---
title: The Service is Already Down title: The Service is Already Down
date: 2018-10-13 date: 2018-10-13
series: stories
--- ---
# The Service is Already Down # The Service is Already Down

View File

@ -1,6 +1,9 @@
--- ---
title: V is for Vaporware title: V is for Vaporware
date: 2019-06-23 date: 2019-06-23
tags:
- v
- rant
--- ---
# V is for Vaporware # V is for Vaporware

View File

@ -1,6 +1,8 @@
--- ---
title: WebAssembly Talk Video Posted title: WebAssembly Talk Video Posted
date: 2019-08-15 date: 2019-08-15
tags:
- wasm
--- ---
# WebAssembly Talk Video Posted # WebAssembly Talk Video Posted

View File

@ -6,6 +6,7 @@ import (
"html/template" "html/template"
"net/http" "net/http"
"path/filepath" "path/filepath"
"strings"
"time" "time"
"christine.website/internal" "christine.website/internal"
@ -69,6 +70,34 @@ var postView = promauto.NewCounterVec(prometheus.CounterOpts{
Help: "The number of views per post or talk", Help: "The number of views per post or talk",
}, []string{"base"}) }, []string{"base"})
func (s *Site) listSeries(w http.ResponseWriter, r *http.Request) {
s.renderTemplatePage("series.html", s.Series).ServeHTTP(w, r)
}
func (s *Site) showSeries(w http.ResponseWriter, r *http.Request) {
if r.RequestURI == "/blog/series/" {
http.Redirect(w, r, "/blog/series", http.StatusSeeOther)
return
}
series := filepath.Base(r.URL.Path)
var posts []blog.Post
for _, p := range s.Posts {
if p.Series == series {
posts = append(posts, p)
}
}
s.renderTemplatePage("serieslist.html", struct {
Name string
Posts []blog.Post
}{
Name: series,
Posts: posts,
}).ServeHTTP(w, r)
}
func (s *Site) showTalk(w http.ResponseWriter, r *http.Request) { func (s *Site) showTalk(w http.ResponseWriter, r *http.Request) {
if r.RequestURI == "/talks/" { if r.RequestURI == "/talks/" {
http.Redirect(w, r, "/talks", http.StatusSeeOther) http.Redirect(w, r, "/talks", http.StatusSeeOther)
@ -136,17 +165,29 @@ func (s *Site) showPost(w http.ResponseWriter, r *http.Request) {
return return
} }
var tags string
if len(p.Tags) != 0 {
for _, t := range p.Tags {
tags = tags + " #" + strings.ReplaceAll(t, "-", "")
}
}
const dateFormat = `2006-01-02` const dateFormat = `2006-01-02`
s.renderTemplatePage("blogpost.html", struct { s.renderTemplatePage("blogpost.html", struct {
Title string Title string
Link string Link string
BodyHTML template.HTML BodyHTML template.HTML
Date string Date string
Series string
Tags string
}{ }{
Title: p.Title, Title: p.Title,
Link: p.Link, Link: p.Link,
BodyHTML: p.BodyHTML, BodyHTML: p.BodyHTML,
Date: p.Date.Format(dateFormat), Date: p.Date.Format(dateFormat),
Series: strings.ReplaceAll(p.Series, "-", ""),
Tags: tags,
}).ServeHTTP(w, r) }).ServeHTTP(w, r)
postView.With(prometheus.Labels{"base": filepath.Base(p.Link)}).Inc() postView.With(prometheus.Labels{"base": filepath.Base(p.Link)}).Inc()
} }

View File

@ -58,6 +58,7 @@ type Site struct {
Posts blog.Posts Posts blog.Posts
Talks blog.Posts Talks blog.Posts
Resume template.HTML Resume template.HTML
Series []string
rssFeed *feeds.Feed rssFeed *feeds.Feed
jsonFeed *jsonfeed.Feed jsonFeed *jsonfeed.Feed
@ -81,7 +82,7 @@ func (s *Site) ServeHTTP(w http.ResponseWriter, r *http.Request) {
middleware.RequestID(s.xffmw.Handler(ex.HTTPLog(s.mux))).ServeHTTP(w, r) middleware.RequestID(s.xffmw.Handler(ex.HTTPLog(s.mux))).ServeHTTP(w, r)
} }
var arbDate = time.Date(2019, time.May, 20, 18, 0, 0, 0, time.UTC) var arbDate = time.Date(2019, time.September, 12, 0, 0, 0, 0, time.UTC)
// Build creates a new Site instance or fails. // Build creates a new Site instance or fails.
func Build() (*Site, error) { func Build() (*Site, error) {
@ -147,6 +148,8 @@ func Build() (*Site, error) {
return nil, err return nil, err
} }
s.Posts = posts s.Posts = posts
s.Series = posts.Series()
sort.Strings(s.Series)
talks, err := blog.LoadPosts("./talks", "talks") talks, err := blog.LoadPosts("./talks", "talks")
if err != nil { if err != nil {
@ -210,6 +213,8 @@ func Build() (*Site, error) {
s.mux.Handle("/blog.atom", middleware.Metrics("blog.atom", http.HandlerFunc(s.createAtom))) s.mux.Handle("/blog.atom", middleware.Metrics("blog.atom", http.HandlerFunc(s.createAtom)))
s.mux.Handle("/blog.json", middleware.Metrics("blog.json", http.HandlerFunc(s.createJSONFeed))) s.mux.Handle("/blog.json", middleware.Metrics("blog.json", http.HandlerFunc(s.createJSONFeed)))
s.mux.Handle("/blog/", middleware.Metrics("blogpost", http.HandlerFunc(s.showPost))) s.mux.Handle("/blog/", middleware.Metrics("blogpost", http.HandlerFunc(s.showPost)))
s.mux.Handle("/blog/series", http.HandlerFunc(s.listSeries))
s.mux.Handle("/blog/series/", http.HandlerFunc(s.showSeries))
s.mux.Handle("/talks/", middleware.Metrics("talks", http.HandlerFunc(s.showTalk))) s.mux.Handle("/talks/", middleware.Metrics("talks", http.HandlerFunc(s.showTalk)))
s.mux.Handle("/css/", http.FileServer(http.Dir("."))) s.mux.Handle("/css/", http.FileServer(http.Dir(".")))
s.mux.Handle("/static/", http.FileServer(http.Dir("."))) s.mux.Handle("/static/", http.FileServer(http.Dir(".")))

View File

@ -20,6 +20,8 @@ type Post struct {
Summary string `json:"summary,omitifempty"` Summary string `json:"summary,omitifempty"`
Body string `json:"-"` Body string `json:"-"`
BodyHTML template.HTML `json:"body"` BodyHTML template.HTML `json:"body"`
Series string `json:"series"`
Tags []string `json:"tags"`
SlidesLink string `json:"slides_link"` SlidesLink string `json:"slides_link"`
Date time.Time Date time.Time
DateString string `json:"date"` DateString string `json:"date"`
@ -28,6 +30,24 @@ type Post struct {
// Posts implements sort.Interface for a slice of Post objects. // Posts implements sort.Interface for a slice of Post objects.
type Posts []Post type Posts []Post
func (p Posts) Series() []string {
names := map[string]struct{}{}
for _, ps := range p {
if ps.Series != "" {
names[ps.Series] = struct{}{}
}
}
var result []string
for name := range names {
result = append(result, name)
}
return result
}
func (p Posts) Len() int { return len(p) } func (p Posts) Len() int { return len(p) }
func (p Posts) Less(i, j int) bool { func (p Posts) Less(i, j int) bool {
iDate := p[i].Date iDate := p[i].Date
@ -42,6 +62,8 @@ func LoadPosts(path string, prepend string) (Posts, error) {
type postFM struct { type postFM struct {
Title string Title string
Date string Date string
Series string
Tags []string
SlidesLink string `yaml:"slides_link"` SlidesLink string `yaml:"slides_link"`
} }
var result Posts var result Posts
@ -91,6 +113,8 @@ func LoadPosts(path string, prepend string) (Posts, error) {
Body: string(remaining), Body: string(remaining),
BodyHTML: template.HTML(output), BodyHTML: template.HTML(output),
SlidesLink: fm.SlidesLink, SlidesLink: fm.SlidesLink,
Series: fm.Series,
Tags: fm.Tags,
} }
result = append(result, p) result = append(result, p)

View File

@ -7,6 +7,8 @@
<p>If you have a compatible reader, be sure to check out my <a href="/blog.rss">RSS Feed</a> for automatic updates. Also check out the <a href="/blog.json">JSONFeed</a>.</p> <p>If you have a compatible reader, be sure to check out my <a href="/blog.rss">RSS Feed</a> for automatic updates. Also check out the <a href="/blog.json">JSONFeed</a>.</p>
<p>For a breakdown by post series, see <a href="/blog/series">here</a>.</p>
<p> <p>
<ul> <ul>
{{ range . }} {{ range . }}

View File

@ -55,6 +55,14 @@
<p>This article was posted on {{ .Date }}. Facts and circumstances may have changed since publication. Please <a href="/contact">contact me</a> before jumping to conclusions if something seems wrong or unclear.</p> <p>This article was posted on {{ .Date }}. Facts and circumstances may have changed since publication. Please <a href="/contact">contact me</a> before jumping to conclusions if something seems wrong or unclear.</p>
{{ if ne .Series "" }}
<p>Series: <a href="/blog/series/{{ .Series }}">{{ .Series }}</a></p>
{{ end }}
{{ if ne .Tags "" }}
<p>Tags:{{.Tags}}</p>
{{ end }}
<script> <script>
// The actual function. Set this as an onclick function for your "Share on Mastodon" button // The actual function. Set this as an onclick function for your "Share on Mastodon" button
@ -91,6 +99,9 @@ function share_on_mastodon() {
// Hashtags // Hashtags
var hashtags = "#blogpost"; var hashtags = "#blogpost";
{{ if ne .Series "" }}hashtags += " #{{ .Series }}";{{ end }}
{{ if ne .Tags "" }}hashtags += "{{ .Tags }}";{{ end }}
// Tagging users, such as offical accounts or the author of the post // Tagging users, such as offical accounts or the author of the post
var author = "@cadey@mst3k.interlinked.me"; var author = "@cadey@mst3k.interlinked.me";

16
templates/series.html Normal file
View File

@ -0,0 +1,16 @@
{{ define "title" }}
<title>Blog Series - Christine Dodrill</title>
{{ end }}
{{ define "content" }}
<h1>Series</h1>
<p>
<ul>
{{ range . }}
<li><a href="/blog/series/{{ . }}">{{ . }}</a></li>
{{ end }}
</ul>
</p>
{{ end }}

16
templates/serieslist.html Normal file
View File

@ -0,0 +1,16 @@
{{ define "title" }}
<title>Blog {{.Name}} - Christine Dodrill</title>
{{ end }}
{{ define "content" }}
<h1>Series: {{ .Name }}</h1>
<p>
<ul>
{{ range .Posts }}
<li>{{ .DateString }} - <a href="/{{ .Link }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</p>
{{ end }}