Add link to comments

This commit is contained in:
ekzyis 2023-08-17 23:21:34 +02:00
parent 167dcf93f3
commit e765141a82
2 changed files with 7 additions and 3 deletions

View File

@ -28,6 +28,7 @@ type MarkdownPost struct {
Date string Date string
ReadingTime string ReadingTime string
Sats int Sats int
Comments string
} }
func NewMarkdownPost(path string) *MarkdownPost { func NewMarkdownPost(path string) *MarkdownPost {
@ -77,6 +78,8 @@ func (post *MarkdownPost) ParseArgs(sc *bufio.Scanner) {
panic(err) panic(err)
} }
post.Sats = int(sats) post.Sats = int(sats)
case "Comments":
post.Comments = parts[1] + ":" + parts[2]
} }
} }
err := sc.Err() err := sc.Err()
@ -96,7 +99,7 @@ func (post *MarkdownPost) InsertHeader(htmlContent *[]byte) {
" |___/ </pre></strong></code>\n" + " |___/ </pre></strong></code>\n" +
"<div><div class=\"font-mono mb-1 text-center\">\n" + "<div><div class=\"font-mono mb-1 text-center\">\n" +
"<strong>{{- .Title }}</strong><br />\n" + "<strong>{{- .Title }}</strong><br />\n" +
"<small>{{- .Date }} | {{ .ReadingTime }} | {{ .Sats }} sats</small>\n" + "<small>{{- .Date }} | {{ .ReadingTime }} | <a target=\"_blank\" href=\"{{ .Comments }}\">Comments</a> | {{ .Sats }} sats</small>\n" +
"</div>\n") "</div>\n")
*htmlContent = append(header, *htmlContent...) *htmlContent = append(header, *htmlContent...)
} }

View File

@ -2,6 +2,7 @@ Title: Demystifying WireGuard and iptables
Date: 2023-08-09 Date: 2023-08-09
ReadingTime: 15 minutes ReadingTime: 15 minutes
Sats: 11623 Sats: 11623
Comments: https://stacker.news/items/221471
--- ---
@ -158,7 +159,7 @@ $ iptables -S --line-numbers
These were all commands we will use in this blog post. These were all commands we will use in this blog post.
If anything is still unclear, don't hesitate to refer to the [manual](https://man.archlinux.org/man/iptables.8.en) If anything is still unclear, don't hesitate to refer to the [manual](https://man.archlinux.org/man/iptables.8.en)
or ask a question in the [comments](https://stacker.news/items/221471). or ask a question in the [comments]({{- .Comments -}}).
--- ---
@ -870,7 +871,7 @@ Thanks for reading my first blog post!
If you want to read more content like this, please consider subscribing via [RSS](/blog/rss.xml). If you want to read more content like this, please consider subscribing via [RSS](/blog/rss.xml).
Also, I would highly appreciate any feedback in the [comments](https://stacker.news/items/221471). Also, I would highly appreciate any feedback in the [comments]({{- .Comments -}}).
You can tell me if it was too long, too boring, too complicated or anything else, that's no problem! You can tell me if it was too long, too boring, too complicated or anything else, that's no problem!
I am very new to this whole blogging thing and thus could really _really_ need **any** kind of feedback. I am very new to this whole blogging thing and thus could really _really_ need **any** kind of feedback.
I'll even pay you 100 sats! I'll even pay you 100 sats!