initial support for tags and series
This commit is contained in:
parent
2007492c49
commit
1740a44b82
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: "Blind Men and an Elephant"
|
||||
date: 2018-11-29
|
||||
series: conlangs
|
||||
---
|
||||
|
||||
# Blind Men and an Elephant
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: How I Converted my Brain fMRI to a 3D Model
|
||||
date: 2019-08-23
|
||||
series: howto
|
||||
---
|
||||
|
||||
# How I Converted my Brain fMRI to a 3D Model
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
title: "Chaos Magick Debugging"
|
||||
date: 2018-11-13
|
||||
thanks: CelestialBoon
|
||||
series: magick
|
||||
---
|
||||
|
||||
# Chaos Magick Debugging
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: My Experience Cursing Out God
|
||||
date: 2018-11-21
|
||||
series: dreams
|
||||
---
|
||||
|
||||
# My Experience Cursing Out God
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
title: Death
|
||||
date: 2018-08-19
|
||||
thanks: Sygma
|
||||
series: magick
|
||||
---
|
||||
|
||||
# Death
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: A Formal Grammar of h
|
||||
date: 2019-05-19
|
||||
series: conlangs
|
||||
---
|
||||
|
||||
# A Formal Grammar of `h`
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: Getting Started with Go
|
||||
date: 2015-01-28
|
||||
series: howto
|
||||
---
|
||||
|
||||
Getting Started with Go
|
||||
|
|
|
@ -3,6 +3,7 @@ title: Gratitude
|
|||
date: 2018-07-20
|
||||
thanks: CelestialBoon
|
||||
for: Mother Aya
|
||||
series: magick
|
||||
---
|
||||
|
||||
# Gratitude
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: How does into Meditation
|
||||
date: 2017-12-10
|
||||
series: when-then-zen
|
||||
---
|
||||
|
||||
# How does into Meditation
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: How to Send Email with Nim
|
||||
date: 2019-08-28
|
||||
series: howto
|
||||
---
|
||||
|
||||
# How to Send Email with Nim
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: How to Use User Mode Linux
|
||||
date: 2019-07-07
|
||||
series: howto
|
||||
---
|
||||
|
||||
# How to Use User Mode Linux
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: "iPad Smart Keyboard: French Accents/Ligatures"
|
||||
date: 2019-05-10
|
||||
series: howto
|
||||
---
|
||||
|
||||
# iPad Smart Keyboard: French Accents/Ligatures
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: "Land 1: Syscalls & File I/O"
|
||||
date: 2018-06-18
|
||||
series: olin
|
||||
---
|
||||
|
||||
# Land 1: Syscalls & File I/O
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
title: Narrative of Sickness
|
||||
date: 2018-08-13
|
||||
for: awakening
|
||||
series: magick
|
||||
---
|
||||
|
||||
# Narrative of Sickness
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: "Olin: 1: Why"
|
||||
date: 2018-09-01
|
||||
series: olin
|
||||
---
|
||||
|
||||
# [Olin][olin]: 1: Why
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: "Olin: 2: The Future"
|
||||
date: 2018-09-05
|
||||
series: olin
|
||||
---
|
||||
|
||||
# [Olin](https://github.com/Xe/olin): 2: The Future
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
title: "One Day"
|
||||
date: 2018-11-01
|
||||
for: "Nicole"
|
||||
series: stories
|
||||
---
|
||||
|
||||
# One Day
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: The Saga of plt, Part 1
|
||||
date: 2015-02-14
|
||||
series: plt
|
||||
---
|
||||
|
||||
The Saga of plt, Part 1
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: The Saga of plt, Part 2
|
||||
date: 2015-02-14
|
||||
series: plt
|
||||
---
|
||||
|
||||
The Saga of plt, Part 2
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: "Instant Pot Quinoa Taco Bowls"
|
||||
date: 2019-08-16
|
||||
series: recipes
|
||||
---
|
||||
|
||||
# Instant Pot Quinoa Taco Bowls
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: Tarot for Hackers
|
||||
date: 2019-07-24
|
||||
series: magick
|
||||
---
|
||||
|
||||
# Tarot for Hackers
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: "TempleOS: 1 - Installation"
|
||||
date: 2019-05-20
|
||||
series: templeos
|
||||
---
|
||||
|
||||
# TempleOS: 1 - Installation
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: "Ten Thousand Laughs"
|
||||
date: "2018-12-01"
|
||||
series: conlangs
|
||||
---
|
||||
|
||||
# Ten Thousand Laughs
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: The Cult of Kubernetes
|
||||
date: 2019-09-07
|
||||
series: howto
|
||||
---
|
||||
|
||||
# The Cult of Kubernetes
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: The Service is Already Down
|
||||
date: 2018-10-13
|
||||
series: stories
|
||||
---
|
||||
|
||||
# The Service is Already Down
|
||||
|
|
|
@ -69,6 +69,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)
|
||||
|
@ -142,11 +170,13 @@ func (s *Site) showPost(w http.ResponseWriter, r *http.Request) {
|
|||
Link string
|
||||
BodyHTML template.HTML
|
||||
Date string
|
||||
Series string
|
||||
}{
|
||||
Title: p.Title,
|
||||
Link: p.Link,
|
||||
BodyHTML: p.BodyHTML,
|
||||
Date: p.Date.Format(dateFormat),
|
||||
Series: p.Series,
|
||||
}).ServeHTTP(w, r)
|
||||
postView.With(prometheus.Labels{"base": filepath.Base(p.Link)}).Inc()
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ type Site struct {
|
|||
Posts blog.Posts
|
||||
Talks blog.Posts
|
||||
Resume template.HTML
|
||||
Series []string
|
||||
|
||||
rssFeed *feeds.Feed
|
||||
jsonFeed *jsonfeed.Feed
|
||||
|
@ -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(".")))
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 . }}
|
||||
|
|
|
@ -55,6 +55,10 @@
|
|||
|
||||
<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 }}
|
||||
|
||||
<script>
|
||||
|
||||
// The actual function. Set this as an onclick function for your "Share on Mastodon" button
|
||||
|
@ -91,6 +95,8 @@ function share_on_mastodon() {
|
|||
// Hashtags
|
||||
var hashtags = "#blogpost";
|
||||
|
||||
{{ if ne .Series "" }}hashtags += " #{{ .Series }}";{{ end }}
|
||||
|
||||
// Tagging users, such as offical accounts or the author of the post
|
||||
var author = "@cadey@mst3k.interlinked.me";
|
||||
|
||||
|
|
|
@ -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 }}
|
|
@ -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 }}
|
Loading…
Reference in New Issue