fix relative urls and make partials for article info

This commit is contained in:
Dmitry Kolosov 2020-02-18 20:52:31 +03:00
parent cc3c20d597
commit 9f0279bfe1
8 changed files with 38 additions and 81 deletions

View File

@ -1,38 +1,16 @@
{{ define "main" }} {{ define "main" }}
<h1>{{ i18n .Title }}</h1> <h1>{{ i18n .Title }}</h1>
{{ range (.Site.RegularPages.GroupByPublishDate "2006") }} {{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ range .Pages }} {{ range $pages }}
<div class="post-short-list"> <div class="post-short-list">
<header> <header>
<h2> <h2>
<a href="{{ .RelPermalink }}">{{ .Title }}</a> <a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h2> </h2>
</header> </header>
{{ partial "articleInfoFull.html" . }}
<div class="article-info">
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
<div class="article-taxonomies">
{{ if .Params.categories }}
<ul class="article-categories">
{{ range .Params.categories }}
<li><a href="categories/{{ . }}">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ if .Params.tags }}
<ul class="article-tags">
{{ range .Params.tags }}
<li><a href="tags/{{ . }}">#{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
</div>
</div>
</div> </div>
{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -7,27 +7,7 @@
<div class="content"> <div class="content">
{{ .Content }} {{ .Content }}
</div> </div>
<div class="article-info"> {{ partial "articleInfoFull.html" . }}
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
<div class="article-taxonomies">
{{ if .Params.categories }}
<ul class="article-categories">
{{ range .Params.categories }}
<li><a href="categories/{{ . }}">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ if .Params.tags }}
<ul class="article-tags">
{{ range .Params.tags }}
<li><a href="tags/{{ . }}">#{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
</div>
</div>
</article> </article>
{{ if .Site.DisqusShortname }} {{ if .Site.DisqusShortname }}
{{ template "_internal/disqus.html" . }} {{ template "_internal/disqus.html" . }}

View File

@ -16,27 +16,8 @@
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a> <a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
</div> </div>
{{ end }} --> {{ end }} -->
<div class="article-info">
{{ if .Params.date }} {{ partial "articleInfoFull.html" . }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
<div class="article-taxonomies">
{{ if .Params.categories }}
<ul class="article-categories">
{{ range .Params.categories }}
<li><a href="categories/{{ . }}">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ if .Params.tags }}
<ul class="article-tags">
{{ range .Params.tags }}
<li><a href="tags/{{ . }}">#{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
</div>
</div>
</article> </article>
{{ end }} {{ end }}
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}

View File

@ -0,0 +1,5 @@
<div class="article-info">
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
</div>

View File

@ -0,0 +1,21 @@
<div class="article-info">
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
<div class="article-taxonomies">
{{ if .Params.categories }}
<ul class="article-categories">
{{ range .Params.categories }}
<li><a href="{{ "categories/" | absURL }}{{ . }}">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ if .Params.tags }}
<ul class="article-tags">
{{ range .Params.tags }}
<li><a href="{{ "tags/" | absURL }}{{ . }}">#{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
</div>
</div>

View File

@ -7,13 +7,13 @@
{{ if eq .Paginator.PageNumber 2 }} {{ if eq .Paginator.PageNumber 2 }}
<a href="{{ .Site.BaseURL }}{{ .Site.LanguagePrefix }}">{{ $toNewPostsMessage }}</a> <a href="{{ .Site.BaseURL }}{{ .Site.LanguagePrefix }}">{{ $toNewPostsMessage }}</a>
{{ else }} {{ else }}
<a href="{{ .Paginator.Prev.URL }}">{{ $toNewPostsMessage }}</a> <a href="{{ .Paginator.Prev.URL | absURL }}">{{ $toNewPostsMessage }}</a>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>
<div class="right pagination-item {{ if not .Paginator.HasNext }}disabled{{ end }}"> <div class="right pagination-item {{ if not .Paginator.HasNext }}disabled{{ end }}">
{{ if .Paginator.HasNext }} {{ if .Paginator.HasNext }}
<a href="{{ .Paginator.Next.URL }}">{{ $toOldPostsMessage }}</a> <a href="{{ .Paginator.Next.URL | absURL }}">{{ $toOldPostsMessage }}</a>
{{ end }} {{ end }}
</div> </div>
</div> </div>

View File

@ -2,7 +2,7 @@
<h1>{{ i18n "category" | humanize }}: {{ .Title }}</h1> <h1>{{ i18n "category" | humanize }}: {{ .Title }}</h1>
<div class="article-info"> <div class="article-info">
<a href="categories/">{{ i18n "toAllCategories" | humanize }}</a> <a href="{{ "categories/" | absURL }}">{{ i18n "toAllCategories" | humanize }}</a>
</div> </div>
{{ range .Data.Pages }} {{ range .Data.Pages }}
<article class="post-list"> <article class="post-list">
@ -15,11 +15,7 @@
<div class="content"> <div class="content">
{{ .Summary }} {{ .Summary }}
</div> </div>
<div class="article-info"> {{ partial "articleInfoDate.html" . }}
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
</div>
<!-- {{ if .Truncated }} <!-- {{ if .Truncated }}
<div class="read-more"> <div class="read-more">
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a> <a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>

View File

@ -2,7 +2,7 @@
<h1>{{ i18n "tag" | humanize }}: {{ .Title }}</h1> <h1>{{ i18n "tag" | humanize }}: {{ .Title }}</h1>
<div class="article-info"> <div class="article-info">
<a href="tags/">{{ i18n "toAllTags" | humanize}}</a> <a href="{{ "tags/" | absURL }}">{{ i18n "toAllTags" | humanize}}</a>
</div> </div>
{{ range .Data.Pages }} {{ range .Data.Pages }}
<article class="post-list"> <article class="post-list">
@ -14,11 +14,7 @@
<div class="content"> <div class="content">
{{ .Summary }} {{ .Summary }}
</div> </div>
<div class="article-info"> {{ partial "articleInfoDate.html" . }}
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
{{ end }}
</div>
<!-- {{ if .Truncated }} <!-- {{ if .Truncated }}
<div class="read-more"> <div class="read-more">
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a> <a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>