mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 20:13:31 +08:00
Support Markdown in post titles.
This commit is contained in:
parent
8ee2ab8062
commit
d29ccf778c
@ -224,7 +224,7 @@ class Search {
|
|||||||
return <article>
|
return <article>
|
||||||
<a href={item.permalink}>
|
<a href={item.permalink}>
|
||||||
<div class="article-details">
|
<div class="article-details">
|
||||||
<h2 class="article-title" dangerouslySetInnerHTML={{ __html: item.title }}></h2>
|
<h2 class="article-title" dangerouslySetInnerHTML={{ __html: this.displayTitle(item) }}></h2>
|
||||||
<secion class="article-preview" dangerouslySetInnerHTML={{ __html: item.preview }}></secion>
|
<secion class="article-preview" dangerouslySetInnerHTML={{ __html: item.preview }}></secion>
|
||||||
</div>
|
</div>
|
||||||
{item.image &&
|
{item.image &&
|
||||||
@ -235,6 +235,10 @@ class Search {
|
|||||||
</a>
|
</a>
|
||||||
</article>;
|
</article>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static displayTitle(item) {
|
||||||
|
return item.title.replace(/_/g, '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<div class="section-card">
|
<div class="section-card">
|
||||||
<div class="section-details">
|
<div class="section-details">
|
||||||
<h3 class="section-count">{{ T "list.page" (len .Pages) }}</h3>
|
<h3 class="section-count">{{ T "list.page" (len .Pages) }}</h3>
|
||||||
<h1 class="section-term">{{ .Title }}</h1>
|
<h1 class="section-term">{{ .Title | markdownify }}</h1>
|
||||||
{{ with .Params.description }}
|
{{ with .Params.description }}
|
||||||
<h2 class="section-description">{{ . }}</h2>
|
<h2 class="section-description">{{ . }}</h2>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<a href="{{ .RelPermalink }}">
|
<a href="{{ .RelPermalink }}">
|
||||||
<div class="article-details">
|
<div class="article-details">
|
||||||
<h2 class="article-title">
|
<h2 class="article-title">
|
||||||
{{- .Title -}}
|
{{- .Title | markdownify -}}
|
||||||
</h2>
|
</h2>
|
||||||
<footer class="article-time">
|
<footer class="article-time">
|
||||||
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
|
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
<div class="article-details">
|
<div class="article-details">
|
||||||
<h2 class="article-title">
|
<h2 class="article-title">
|
||||||
{{- .context.Title -}}
|
{{- .context.Title | markdownify -}}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<h2 class="article-title">
|
<h2 class="article-title">
|
||||||
<a href="{{ .RelPermalink }}">
|
<a href="{{ .RelPermalink }}">
|
||||||
{{- .Title -}}
|
{{- .Title | markdownify -}}
|
||||||
</a>
|
</a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<meta name='description' content='{{ $description }}'>
|
<meta name='description' content='{{ $description }}'>
|
||||||
|
|
||||||
{{- $title := partialCached "data/title" . .RelPermalink -}}
|
{{- $title := partialCached "data/title" . .RelPermalink -}}
|
||||||
<title>{{ $title }}</title>
|
<title>{{ $title | markdownify | plainify | htmlUnescape }}</title>
|
||||||
|
|
||||||
<link rel='canonical' href='{{ .Permalink }}'>
|
<link rel='canonical' href='{{ .Permalink }}'>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user