Fix rendering Markdown title

This commit is contained in:
Jan-Lukas Else 2021-08-04 23:26:38 +02:00
parent 586bd46b31
commit 663e6932bf
33 changed files with 94 additions and 51 deletions

View File

@ -106,7 +106,7 @@ func (a *goBlog) toASNote(p *post) *asNote {
AttributedTo: a.apIri(a.cfg.Blogs[p.Blog]), AttributedTo: a.apIri(a.cfg.Blogs[p.Blog]),
} }
// Name and Type // Name and Type
if title := a.renderText(p.Title()); title != "" { if title := a.renderMdTitle(p.Title()); title != "" {
as.Name = title as.Name = title
as.Type = "Article" as.Type = "Article"
} else { } else {

2
app.go
View File

@ -52,7 +52,7 @@ type goBlog struct {
// Logs // Logs
logf *rotatelogs.RotateLogs logf *rotatelogs.RotateLogs
// Markdown // Markdown
md, absoluteMd goldmark.Markdown md, absoluteMd, titleMd goldmark.Markdown
// Media // Media
compressorsInit sync.Once compressorsInit sync.Once
compressors []mediaCompression compressors []mediaCompression

View File

@ -42,7 +42,7 @@ func (a *goBlog) generateFeed(blog string, f feedType, w http.ResponseWriter, r
} }
for _, p := range posts { for _, p := range posts {
feed.Add(&feeds.Item{ feed.Add(&feeds.Item{
Title: a.renderText(p.Title()), Title: a.renderMdTitle(p.Title()),
Link: &feeds.Link{Href: a.fullPostURL(p)}, Link: &feeds.Link{Href: a.fullPostURL(p)},
Description: a.postSummary(p), Description: a.postSummary(p),
Id: p.Path, Id: p.Path,

View File

@ -41,6 +41,33 @@ func (a *goBlog) initMarkdown() {
absoluteLinks: true, absoluteLinks: true,
publicAddress: a.cfg.Server.PublicAddress, publicAddress: a.cfg.Server.PublicAddress,
}))...) }))...)
a.titleMd = goldmark.New(
goldmark.WithParser(
// Override to disable lists
parser.NewParser(
parser.WithBlockParsers(
// util.Prioritized(parser.NewSetextHeadingParser(), 100),
util.Prioritized(parser.NewThematicBreakParser(), 200),
// util.Prioritized(parser.NewListParser(), 300),
// util.Prioritized(parser.NewListItemParser(), 400),
util.Prioritized(parser.NewCodeBlockParser(), 500),
// util.Prioritized(parser.NewATXHeadingParser(), 600),
util.Prioritized(parser.NewFencedCodeBlockParser(), 700),
util.Prioritized(parser.NewBlockquoteParser(), 800),
util.Prioritized(parser.NewHTMLBlockParser(), 900),
util.Prioritized(parser.NewParagraphParser(), 1000)),
parser.WithInlineParsers(parser.DefaultInlineParsers()...),
parser.WithParagraphTransformers(parser.DefaultParagraphTransformers()...),
),
),
goldmark.WithRendererOptions(
html.WithUnsafe(),
),
goldmark.WithExtensions(
extension.Typographer,
emoji.Emoji,
),
)
} }
func (a *goBlog) renderMarkdown(source string, absoluteLinks bool) (rendered []byte, err error) { func (a *goBlog) renderMarkdown(source string, absoluteLinks bool) (rendered []byte, err error) {
@ -74,6 +101,15 @@ func (a *goBlog) renderText(s string) string {
return htmlText(h) return htmlText(h)
} }
func (a *goBlog) renderMdTitle(s string) string {
var buffer bytes.Buffer
err := a.titleMd.Convert([]byte(s), &buffer)
if err != nil {
return ""
}
return htmlText(buffer.Bytes())
}
// Extensions etc... // Extensions etc...
// Links // Links

View File

@ -68,6 +68,13 @@ func Test_markdown(t *testing.T) {
t.Errorf("Wrong result, got \"%v\"", renderedText) t.Errorf("Wrong result, got \"%v\"", renderedText)
} }
// Title
renderedTitle := app.renderMdTitle("3. **Test**")
if renderedTitle != "3. Test" {
t.Errorf("Wrong result, got \"%v\"", renderedTitle)
}
// Template func // Template func
renderedText = string(app.safeRenderMarkdownAsHTML("[Relative](/relative)")) renderedText = string(app.safeRenderMarkdownAsHTML("[Relative](/relative)"))

View File

@ -44,9 +44,9 @@ const (
func (a *goBlog) initRendering() error { func (a *goBlog) initRendering() error {
a.templates = map[string]*template.Template{} a.templates = map[string]*template.Template{}
templateFunctions := template.FuncMap{ templateFunctions := template.FuncMap{
"md": a.safeRenderMarkdownAsHTML, "md": a.safeRenderMarkdownAsHTML,
"mdtext": a.renderText, "mdtitle": a.renderMdTitle,
"html": wrapStringAsHTML, "html": wrapStringAsHTML,
// Post specific // Post specific
"ps": postParameter, "ps": postParameter,
"content": a.postHtml, "content": a.postHtml,

View File

@ -16,7 +16,7 @@ const telegramBaseURL = "https://api.telegram.org/bot"
func (a *goBlog) initTelegram() { func (a *goBlog) initTelegram() {
a.pPostHooks = append(a.pPostHooks, func(p *post) { a.pPostHooks = append(a.pPostHooks, func(p *post) {
if tg := a.cfg.Blogs[p.Blog].Telegram; tg.enabled() && p.isPublishedSectionPost() { if tg := a.cfg.Blogs[p.Blog].Telegram; tg.enabled() && p.isPublishedSectionPost() {
if html := tg.generateHTML(a.renderText(p.Title()), a.fullPostURL(p), a.shortPostURL(p)); html != "" { if html := tg.generateHTML(a.renderMdTitle(p.Title()), a.fullPostURL(p), a.shortPostURL(p)); html != "" {
if err := a.send(tg, html, "HTML"); err != nil { if err := a.send(tg, html, "HTML"); err != nil {
log.Printf("Failed to send post to Telegram: %v", err) log.Printf("Failed to send post to Telegram: %v", err)
} }

View File

@ -6,11 +6,11 @@
<link rel="stylesheet" href="{{ asset "css/styles.css" }}"> <link rel="stylesheet" href="{{ asset "css/styles.css" }}">
{{ with .Canonical }}<link rel="canonical" href="{{ . }}">{{ end }} {{ with .Canonical }}<link rel="canonical" href="{{ . }}">{{ end }}
{{ block "title" . }} {{ block "title" . }}
<title>{{ mdtext .Blog.Title }}</title> <title>{{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
<link rel="alternate" type="application/rss+xml" title="RSS ({{ mdtext .Blog.Title }})" href="{{ .Blog.Path }}.rss"/> <link rel="alternate" type="application/rss+xml" title="RSS ({{ mdtitle .Blog.Title }})" href="{{ .Blog.Path }}.rss"/>
<link rel="alternate" type="application/atom+xml" title="Atom ({{ mdtext .Blog.Title }})" href="{{ .Blog.Path }}.atom"/> <link rel="alternate" type="application/atom+xml" title="Atom ({{ mdtitle .Blog.Title }})" href="{{ .Blog.Path }}.atom"/>
<link rel="alternate" type="application/feed+json" title="JSON Feed ({{ mdtext .Blog.Title }})" href="{{ .Blog.Path }}.json"/> <link rel="alternate" type="application/feed+json" title="JSON Feed ({{ mdtitle .Blog.Title }})" href="{{ .Blog.Path }}.json"/>
<link rel="webmention" href="{{ absolute "/webmention" }}" /> <link rel="webmention" href="{{ absolute "/webmention" }}" />
<link rel="micropub" href="/micropub" /> <link rel="micropub" href="/micropub" />
<link rel="authorization_endpoint" href="/indieauth" /> <link rel="authorization_endpoint" href="/indieauth" />
@ -18,7 +18,7 @@
{{ with .User }}{{ range .Identities }}<link rel="me" href="{{ . }}" />{{ end }}{{ end }} {{ with .User }}{{ range .Identities }}<link rel="me" href="{{ . }}" />{{ end }}{{ end }}
{{ $os := opensearch .Blog }} {{ $os := opensearch .Blog }}
{{ if $os }} {{ if $os }}
<link rel="search" type="application/opensearchdescription+xml" href="{{ $os }}" title="{{ mdtext .Blog.Title }}" /> <link rel="search" type="application/opensearchdescription+xml" href="{{ $os }}" title="{{ mdtitle .Blog.Title }}" />
{{ end }} {{ end }}
{{ include "header" . }} {{ include "header" . }}
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}

View File

@ -1,10 +1,10 @@
{{ define "title" }} {{ define "title" }}
<title>{{ mdtext .Data.Title }} - {{ mdtext .Blog.Title }}</title> <title>{{ mdtitle .Data.Title }} - {{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}
<main> <main>
{{ with .Data.Title }}<h1>{{ mdtext . }}</h1>{{ end }} {{ with .Data.Title }}<h1>{{ mdtitle . }}</h1>{{ end }}
{{ with .Data.Description }}{{ md . }}{{ end }} {{ with .Data.Description }}{{ md . }}{{ end }}
<p><a href="{{ .Blog.RelativePath .Data.Download }}" class="button" download>{{ string .Blog.Lang "download" }}</a></p> <p><a href="{{ .Blog.RelativePath .Data.Download }}" class="button" download>{{ string .Blog.Lang "download" }}</a></p>
{{ $lang := .Blog.Lang }} {{ $lang := .Blog.Lang }}

View File

@ -1,10 +1,10 @@
{{ define "title" }} {{ define "title" }}
<title>{{ with .Blog.BlogStats.Title }}{{ mdtext . }} - {{ end }}{{ mdtext .Blog.Title }}</title> <title>{{ with .Blog.BlogStats.Title }}{{ mdtitle . }} - {{ end }}{{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}
<main> <main>
{{ with .Blog.BlogStats.Title }}<h1>{{ mdtext . }}</h1>{{ end }} {{ with .Blog.BlogStats.Title }}<h1>{{ mdtitle . }}</h1>{{ end }}
{{ with .Blog.BlogStats.Description }}{{ md . }}{{ end }} {{ with .Blog.BlogStats.Description }}{{ md . }}{{ end }}
<p id="loading" data-table="{{.Data.TableUrl}}">{{ string .Blog.Lang "loading" }}</p> <p id="loading" data-table="{{.Data.TableUrl}}">{{ string .Blog.Lang "loading" }}</p>
<script defer src="{{ asset "js/blogstats.js" }}"></script> <script defer src="{{ asset "js/blogstats.js" }}"></script>

View File

@ -1,5 +1,5 @@
{{ define "title" }} {{ define "title" }}
<title>{{ string .Blog.Lang "captcha" }} - {{ mdtext .Blog.Title }}</title> <title>{{ string .Blog.Lang "captcha" }} - {{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}

View File

@ -1,5 +1,5 @@
{{ define "title" }} {{ define "title" }}
<title>{{ string .Blog.Lang "comments" }} - {{ mdtext .Blog.Title }}</title> <title>{{ string .Blog.Lang "comments" }} - {{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}

View File

@ -7,7 +7,7 @@
{{ if .Data.sent }} {{ if .Data.sent }}
<p>{{ string .Blog.Lang "messagesent" }}</p> <p>{{ string .Blog.Lang "messagesent" }}</p>
{{ else }} {{ else }}
{{ with .Data.title }}<h1>{{ mdtext . }}</h1>{{ end }} {{ with .Data.title }}<h1>{{ mdtitle . }}</h1>{{ end }}
{{ with .Data.description }}{{ md . }}{{ end }} {{ with .Data.description }}{{ md . }}{{ end }}
<form class="fw p" method="post"> <form class="fw p" method="post">
<input type="text" name="name" placeholder="{{ string .Blog.Lang "nameopt" }}"> <input type="text" name="name" placeholder="{{ string .Blog.Lang "nameopt" }}">

View File

@ -1,5 +1,5 @@
{{ define "title" }} {{ define "title" }}
<title>{{ string .Blog.Lang "editor" }} - {{ mdtext .Blog.Title }}</title> <title>{{ string .Blog.Lang "editor" }} - {{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}

View File

@ -1,5 +1,5 @@
{{ define "title" }} {{ define "title" }}
<title>{{ string .Blog.Lang "mediafiles" }} - {{ mdtext .Blog.Title }}</title> <title>{{ string .Blog.Lang "mediafiles" }} - {{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}

View File

@ -1,10 +1,10 @@
{{ define "footer" }} {{ define "footer" }}
<footer> <footer>
{{ with index .Blog.Menus "footer" }} {{ with index .Blog.Menus "footer" }}
<nav>{{ range $i, $item := .Items }}{{ if ne $i 0 }} &bull; {{ end }}<a href="{{ $item.Link }}">{{ mdtext $item.Title }}</a>{{ end }} <nav>{{ range $i, $item := .Items }}{{ if ne $i 0 }} &bull; {{ end }}<a href="{{ $item.Link }}">{{ mdtitle $item.Title }}</a>{{ end }}
</nav> </nav>
{{ end }} {{ end }}
<p translate="no">&copy; {{ dateformat now "2006" }} {{ with .User.Name }}{{ . }}{{ else }}{{ mdtext .Blog.Title }}{{ end }}</p> <p translate="no">&copy; {{ dateformat now "2006" }} {{ with .User.Name }}{{ . }}{{ else }}{{ mdtitle .Blog.Title }}{{ end }}</p>
{{ if .TorUsed }} {{ if .TorUsed }}
<p id="tor">🔐 {{ string .Blog.Lang "connectedviator" }}</p> <p id="tor">🔐 {{ string .Blog.Lang "connectedviator" }}</p>
{{ else }} {{ else }}

View File

@ -1,5 +1,5 @@
{{ define "title" }} {{ define "title" }}
<title>{{ mdtext .Blog.Title }}</title> <title>{{ mdtitle .Blog.Title }}</title>
{{ if not .Data.nolocations }} {{ if not .Data.nolocations }}
<link rel="stylesheet" href="{{ .Data.mappath }}/leaflet/leaflet.css"/> <link rel="stylesheet" href="{{ .Data.mappath }}/leaflet/leaflet.css"/>
<script src="{{ .Data.mappath }}/leaflet/leaflet.js"></script> <script src="{{ .Data.mappath }}/leaflet/leaflet.js"></script>

View File

@ -1,10 +1,10 @@
{{ define "header" }} {{ define "header" }}
<header> <header>
<h1><a href="{{ .Blog.RelativePath "/" }}" rel="home" title="{{ mdtext .Blog.Title }}" translate="no">{{ mdtext .Blog.Title }}</a></h1> <h1><a href="{{ .Blog.RelativePath "/" }}" rel="home" title="{{ mdtitle .Blog.Title }}" translate="no">{{ mdtitle .Blog.Title }}</a></h1>
{{ with .Blog.Description }}<p><i>{{ . }}</i></p>{{ end }} {{ with .Blog.Description }}<p><i>{{ . }}</i></p>{{ end }}
<nav> <nav>
{{ with index .Blog.Menus "main" }} {{ with index .Blog.Menus "main" }}
{{ range $i, $item := .Items }}{{ if ne $i 0 }} &bull; {{ end }}<a href="{{ $item.Link }}">{{ mdtext $item.Title }}</a>{{ end }} {{ range $i, $item := .Items }}{{ if ne $i 0 }} &bull; {{ end }}<a href="{{ $item.Link }}">{{ mdtitle $item.Title }}</a>{{ end }}
{{ end }} {{ end }}
</nav> </nav>
{{ if .LoggedIn }} {{ if .LoggedIn }}

View File

@ -1,13 +1,13 @@
{{ define "title" }} {{ define "title" }}
<title>{{ with .Data.Title }}{{ mdtext . }} - {{ end }}{{ mdtext .Blog.Title }}</title> <title>{{ with .Data.Title }}{{ mdtitle . }} - {{ end }}{{ mdtitle .Blog.Title }}</title>
<link rel="alternate" type="application/rss+xml" title="RSS{{ with .Data.Title }} ({{ mdtext . }}){{ end }}" href="{{ .Data.First }}.rss"/> <link rel="alternate" type="application/rss+xml" title="RSS{{ with .Data.Title }} ({{ mdtitle . }}){{ end }}" href="{{ .Data.First }}.rss"/>
<link rel="alternate" type="application/atom+xml" title="Atom{{ with .Data.Title }} ({{ mdtext . }}){{ end }}" href="{{ .Data.First }}.atom"/> <link rel="alternate" type="application/atom+xml" title="Atom{{ with .Data.Title }} ({{ mdtitle . }}){{ end }}" href="{{ .Data.First }}.atom"/>
<link rel="alternate" type="application/feed+json" title="JSON Feed{{ with .Data.Title }} ({{ mdtext . }}){{ end }}" href="{{ .Data.First }}.json"/> <link rel="alternate" type="application/feed+json" title="JSON Feed{{ with .Data.Title }} ({{ mdtitle . }}){{ end }}" href="{{ .Data.First }}.json"/>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}
<main class="h-feed"> <main class="h-feed">
{{ with .Data.Title }}<h1 class="p-name">{{ mdtext . }}</h1>{{ end }} {{ with .Data.Title }}<h1 class="p-name">{{ mdtitle . }}</h1>{{ end }}
{{ with .Data.Description }}{{ md . }}{{ end }} {{ with .Data.Description }}{{ md . }}{{ end }}
{{ if (or .Data.Title .Data.Description) }} {{ if (or .Data.Title .Data.Description) }}
<hr> <hr>

View File

@ -1,5 +1,5 @@
{{ define "title" }} {{ define "title" }}
<title>{{ string .Blog.Lang "login" }} - {{ mdtext .Blog.Title }}</title> <title>{{ string .Blog.Lang "login" }} - {{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}

View File

@ -1,5 +1,5 @@
{{ define "title" }} {{ define "title" }}
<title>{{ string "notifications" }} - {{ mdtext .Blog.Title }}</title> <title>{{ string "notifications" }} - {{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}

View File

@ -4,7 +4,7 @@
{{ if .Data.Title }} {{ if .Data.Title }}
<h2 class="p-name"> <h2 class="p-name">
<a class="u-url" href="{{ .Data.Path }}"> <a class="u-url" href="{{ .Data.Path }}">
{{ mdtext .Data.Title }} {{ mdtitle .Data.Title }}
</a> </a>
</h2> </h2>
{{ end }} {{ end }}

View File

@ -1,5 +1,5 @@
{{ define "title" }} {{ define "title" }}
<title>{{ with .Data.Title }}{{ mdtext . }} - {{end}}{{ mdtext .Blog.Title }}</title> <title>{{ with .Data.Title }}{{ mdtitle . }} - {{end}}{{ mdtitle .Blog.Title }}</title>
{{ include "postheadmeta" . }} {{ include "postheadmeta" . }}
{{ with shorturl .Data }}<link rel="shortlink" href="{{ . }}">{{ end }} {{ with shorturl .Data }}<link rel="shortlink" href="{{ . }}">{{ end }}
{{ end }} {{ end }}
@ -8,7 +8,7 @@
<main class=h-entry> <main class=h-entry>
<article> <article>
<data class="u-url hide" value="{{ absolute .Data.Path }}"></data> <data class="u-url hide" value="{{ absolute .Data.Path }}"></data>
{{ with .Data.Title }}<h1 class=p-name>{{ mdtext . }}</h1>{{ end }} {{ with .Data.Title }}<h1 class=p-name>{{ mdtitle . }}</h1>{{ end }}
{{ include "postmeta" . }} {{ include "postmeta" . }}
{{ include "postactions" . }} {{ include "postactions" . }}
{{ if .Data.Content }} {{ if .Data.Content }}

View File

@ -1,6 +1,6 @@
{{ define "postactions" }} {{ define "postactions" }}
<div class="p flex" id="post-actions"> <div class="p flex" id="post-actions">
<a href="https://www.addtoany.com/share#url={{ absolute .Data.Path }}{{ with .Data.Title }}&title={{ mdtext . }}{{ end }}" target="_blank" rel="nofollow noopener noreferrer" class="button">{{ string .Blog.Lang "share" }}</a>&nbsp; <a href="https://www.addtoany.com/share#url={{ absolute .Data.Path }}{{ with .Data.Title }}&title={{ mdtitle . }}{{ end }}" target="_blank" rel="nofollow noopener noreferrer" class="button">{{ string .Blog.Lang "share" }}</a>&nbsp;
<a id="translateBtn" href="https://translate.google.com/translate?u={{ absolute .Data.Path }}" target="_blank" rel="nofollow noopener noreferrer" class="button">{{ string .Blog.Lang "translate" }}</a>&nbsp; <a id="translateBtn" href="https://translate.google.com/translate?u={{ absolute .Data.Path }}" target="_blank" rel="nofollow noopener noreferrer" class="button">{{ string .Blog.Lang "translate" }}</a>&nbsp;
<script defer src="{{ asset "js/translate.js" }}"></script> <script defer src="{{ asset "js/translate.js" }}"></script>
<button id="speakBtn" class="hide" data-speak="{{ string .Blog.Lang "speak" }}" data-stopspeak="{{ string .Blog.Lang "stopspeak" }}"></button> <button id="speakBtn" class="hide" data-speak="{{ string .Blog.Lang "speak" }}" data-stopspeak="{{ string .Blog.Lang "stopspeak" }}"></button>

View File

@ -4,8 +4,8 @@
<meta property="twitter:url" content="{{ . }}"> <meta property="twitter:url" content="{{ . }}">
{{ end }} {{ end }}
{{ with .Data.Title }} {{ with .Data.Title }}
<meta property="og:title" content="{{ mdtext . }}"> <meta property="og:title" content="{{ mdtitle . }}">
<meta property="twitter:title" content="{{ mdtext . }}"> <meta property="twitter:title" content="{{ mdtitle . }}">
{{ end }} {{ end }}
{{ with summary .Data }} {{ with summary .Data }}
<meta name="description" content="{{ . }}"> <meta name="description" content="{{ . }}">

View File

@ -3,7 +3,7 @@
{{ include "summaryandpostmeta" . }} {{ include "summaryandpostmeta" . }}
{{ $translations := (translations .Data) }} {{ $translations := (translations .Data) }}
{{ if gt (len $translations) 0 }} {{ if gt (len $translations) 0 }}
<div>{{ string .Blog.Lang "translations" }}: {{ $delimiter := "" }}{{ range $i, $t := $translations }}{{ $delimiter }}<a href="{{ $t.Path }}" translate="no">{{ mdtext $t.Title }}</a>{{ $delimiter = ", " }}{{ end }}</div> <div>{{ string .Blog.Lang "translations" }}: {{ $delimiter := "" }}{{ range $i, $t := $translations }}{{ $delimiter }}<a href="{{ $t.Path }}" translate="no">{{ mdtitle $t.Title }}</a>{{ $delimiter = ", " }}{{ end }}</div>
{{ end }} {{ end }}
{{ $short := shorturl .Data }} {{ $short := shorturl .Data }}
{{ if $short }}<div>{{ string .Blog.Lang "shorturl" }} <a href="{{ $short }}" rel="shortlink">{{ $short }}</a></div>{{ end }} {{ if $short }}<div>{{ string .Blog.Lang "shorturl" }} <a href="{{ $short }}" rel="shortlink">{{ $short }}</a></div>{{ end }}

View File

@ -4,9 +4,9 @@
{{ range $i, $tax := $blog.Taxonomies }} {{ range $i, $tax := $blog.Taxonomies }}
{{ $tvs := sort (ps $post $tax.Name) }} {{ $tvs := sort (ps $post $tax.Name) }}
{{ if $tvs }} {{ if $tvs }}
<p><b>{{ mdtext $tax.Title }}</b>: <p><b>{{ mdtitle $tax.Title }}</b>:
{{ range $j, $tv := $tvs }} {{ range $j, $tv := $tvs }}
<a class="p-category" rel="tag" href="{{ $blog.RelativePath ( printf "/%s/%s" $tax.Name (urlize $tv) ) }}">{{ mdtext $tv }}</a> <a class="p-category" rel="tag" href="{{ $blog.RelativePath ( printf "/%s/%s" $tax.Name (urlize $tv) ) }}">{{ mdtitle $tv }}</a>
{{ end }} {{ end }}
</p> </p>
{{ end }} {{ end }}

View File

@ -1,16 +1,16 @@
{{ define "title" }} {{ define "title" }}
<title>{{ with .Blog.Search.Title }}{{ mdtext . }} - {{ end }}{{ mdtext .Blog.Title }}</title> <title>{{ with .Blog.Search.Title }}{{ mdtitle . }} - {{ end }}{{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}
<main> <main>
{{ with .Blog.Search.Title }}<h1>{{ mdtext . }}</h1>{{ end }} {{ with .Blog.Search.Title }}<h1>{{ mdtitle . }}</h1>{{ end }}
{{ with .Blog.Search.Description }}{{ md . }}{{ end }} {{ with .Blog.Search.Description }}{{ md . }}{{ end }}
{{ if (or .Blog.Search.Title .Blog.Search.Description) }} {{ if (or .Blog.Search.Title .Blog.Search.Description) }}
<hr> <hr>
{{ end }} {{ end }}
<form class="fw p" method="post"> <form class="fw p" method="post">
<input type="text" name="q" {{ with .Blog.Search.Placeholder }}placeholder="{{ mdtext . }}"{{ end }}> <input type="text" name="q" {{ with .Blog.Search.Placeholder }}placeholder="{{ mdtitle . }}"{{ end }}>
<input type="submit" value="🔍 {{ string .Blog.Lang "search" }}"> <input type="submit" value="🔍 {{ string .Blog.Lang "search" }}">
</form> </form>
</main> </main>

View File

@ -1,5 +1,5 @@
{{ define "title" }} {{ define "title" }}
<title>{{ mdtext .Blog.Title }}</title> <title>{{ mdtitle .Blog.Title }}</title>
{{ include "postheadmeta" . }} {{ include "postheadmeta" . }}
{{ end }} {{ end }}

View File

@ -4,7 +4,7 @@
{{ if .Data.Title }} {{ if .Data.Title }}
<h2 class="p-name"> <h2 class="p-name">
<a class="u-url" href="{{ .Data.Path }}"> <a class="u-url" href="{{ .Data.Path }}">
{{ mdtext .Data.Title }} {{ mdtitle .Data.Title }}
</a> </a>
</h2> </h2>
{{ end }} {{ end }}

View File

@ -1,6 +1,6 @@
{{ define "summaryandpostmeta" }} {{ define "summaryandpostmeta" }}
{{ $section := (index .Blog.Sections .Data.Section) }} {{ $section := (index .Blog.Sections .Data.Section) }}
{{ if .Data.Published }}<div>{{ string .Blog.Lang "publishedon" }} <time class="dt-published" datetime="{{ dateformat .Data.Published "2006-01-02T15:04:05Z07:00"}}">{{ isodate .Data.Published }}</time>{{ if $section }} in <a href="{{ .Blog.RelativePath $section.Name }}">{{ mdtext $section.Title }}</a>{{ end }}</div>{{ end }} {{ if .Data.Published }}<div>{{ string .Blog.Lang "publishedon" }} <time class="dt-published" datetime="{{ dateformat .Data.Published "2006-01-02T15:04:05Z07:00"}}">{{ isodate .Data.Published }}</time>{{ if $section }} in <a href="{{ .Blog.RelativePath $section.Name }}">{{ mdtitle $section.Title }}</a>{{ end }}</div>{{ end }}
{{ if .Data.Updated }}<div>{{ string .Blog.Lang "updatedon" }} <time class="dt-updated" datetime="{{ dateformat .Data.Updated "2006-01-02T15:04:05Z07:00"}}">{{ isodate .Data.Updated }}</time></div>{{ end }} {{ if .Data.Updated }}<div>{{ string .Blog.Lang "updatedon" }} <time class="dt-updated" datetime="{{ dateformat .Data.Updated "2006-01-02T15:04:05Z07:00"}}">{{ isodate .Data.Updated }}</time></div>{{ end }}
{{ if replylink .Data }} {{ if replylink .Data }}
<div>{{ string .Blog.Lang "replyto" }}: <a class="u-in-reply-to" href="{{ replylink .Data }}" target="_blank" rel="noopener">{{ with (replytitle .Data) }}{{ . }}{{ else }}{{ replylink .Data }}{{ end }}</a></div> <div>{{ string .Blog.Lang "replyto" }}: <a class="u-in-reply-to" href="{{ replylink .Data }}" target="_blank" rel="noopener">{{ with (replytitle .Data) }}{{ . }}{{ else }}{{ replylink .Data }}{{ end }}</a></div>

View File

@ -1,10 +1,10 @@
{{ define "title" }} {{ define "title" }}
<title>{{ mdtext .Data.Taxonomy.Title }} - {{ mdtext .Blog.Title }}</title> <title>{{ mdtitle .Data.Taxonomy.Title }} - {{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}
<main> <main>
{{ with .Data.Taxonomy.Title }}<h1>{{ mdtext . }}</h1>{{ end }} {{ with .Data.Taxonomy.Title }}<h1>{{ mdtitle . }}</h1>{{ end }}
{{ with .Data.Taxonomy.Description }}{{ md . }}{{ end }} {{ with .Data.Taxonomy.Description }}{{ md . }}{{ end }}
{{ $blog := .Blog }} {{ $blog := .Blog }}
{{ $taxonomy := .Data.Taxonomy.Name }} {{ $taxonomy := .Data.Taxonomy.Name }}

View File

@ -1,5 +1,5 @@
{{ define "title" }} {{ define "title" }}
<title>{{ string .Blog.Lang "webmentions" }} - {{ mdtext .Blog.Title }}</title> <title>{{ string .Blog.Lang "webmentions" }} - {{ mdtitle .Blog.Title }}</title>
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}