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"
date: 2019-06-24
tags:
- v
- security
- release
---
# OVE-20190623-0001

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,10 @@
---
title: How I Converted my Brain fMRI to a 3D Model
date: 2019-08-23
series: howto
tags:
- python
- blender
---
# 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
date: 2019-06-18
tags:
- career
---
# Advice to People Nurturing a Career in Computering

View File

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

View File

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

View File

@ -1,6 +1,8 @@
---
title: Coding on an iPad
date: 2018-04-14
tags:
- 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
[workingcopy]: https://itunes.apple.com/us/app/working-copy/id896694807?mt=8
[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
date: 2015-12-01
tags:
- personal
---
Coming Out

View File

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

View File

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

View File

@ -1,6 +1,7 @@
---
title: My Experience Cursing Out God
date: 2018-11-21
series: dreams
---
# 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.
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
date: 2018-08-19
thanks: Sygma
series: magick
---
# Death

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,6 +2,8 @@
title: "Life Update - Montréal"
date: "2019-05-16"
for: "Vic"
tags:
- personal
---
# 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.
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
date: 2018-02-08
github_issue: https://github.com/Xe/lokahi/issues/15
tags:
- hackweek
- release
- go
- monitoring
---
# Introducing Lokahi

View File

@ -1,6 +1,10 @@
---
title: MrBeast is Postmodern Gold
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.

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@
title: "One Day"
date: 2018-11-01
for: "Nicole"
series: stories
---
# 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".
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
date: 2015-02-14
series: plt
---
The Saga of plt, Part 1

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -58,6 +58,7 @@ type Site struct {
Posts blog.Posts
Talks blog.Posts
Resume template.HTML
Series []string
rssFeed *feeds.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)
}
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.
func Build() (*Site, error) {
@ -147,6 +148,8 @@ func Build() (*Site, error) {
return nil, err
}
s.Posts = posts
s.Series = posts.Series()
sort.Strings(s.Series)
talks, err := blog.LoadPosts("./talks", "talks")
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.json", middleware.Metrics("blog.json", http.HandlerFunc(s.createJSONFeed)))
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("/css/", 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"`
Body string `json:"-"`
BodyHTML template.HTML `json:"body"`
Series string `json:"series"`
Tags []string `json:"tags"`
SlidesLink string `json:"slides_link"`
Date time.Time
DateString string `json:"date"`
@ -28,6 +30,24 @@ type Post struct {
// Posts implements sort.Interface for a slice of Post objects.
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) Less(i, j int) bool {
iDate := p[i].Date
@ -42,6 +62,8 @@ func LoadPosts(path string, prepend string) (Posts, error) {
type postFM struct {
Title string
Date string
Series string
Tags []string
SlidesLink string `yaml:"slides_link"`
}
var result Posts
@ -91,6 +113,8 @@ func LoadPosts(path string, prepend string) (Posts, error) {
Body: string(remaining),
BodyHTML: template.HTML(output),
SlidesLink: fm.SlidesLink,
Series: fm.Series,
Tags: fm.Tags,
}
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>For a breakdown by post series, see <a href="/blog/series">here</a>.</p>
<p>
<ul>
{{ 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>
{{ if ne .Series "" }}
<p>Series: <a href="/blog/series/{{ .Series }}">{{ .Series }}</a></p>
{{ end }}
{{ if ne .Tags "" }}
<p>Tags:{{.Tags}}</p>
{{ end }}
<script>
// The actual function. Set this as an onclick function for your "Share on Mastodon" button
@ -91,6 +99,9 @@ function share_on_mastodon() {
// Hashtags
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
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 }}