Mobile: center pinned post, pagination fixes, minor layout tweaks
- First (pinned) post on mobile: title and image centered - Pagination: restored page counter on mobile, buttons above footer - Typography and layout minor improvements Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<p>{{ .Description }}</p>
|
||||
</header>
|
||||
{{ if .Params.image }}
|
||||
<div class="image main"><img src="{{ .Params.image | relURL }}" alt="" /></div>
|
||||
<div class="image main"><img src="{{ .Params.image | relURL }}" alt="{{ .Title }}" loading="lazy" /></div>
|
||||
{{ end }}
|
||||
{{ .Content }}
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<!-- Copyright -->
|
||||
<div id="copyright">
|
||||
<ul><li>© {{ .Site.Title }}</li><li>{{ i18n "COPYRIGHT_MESSAGE_1" . | markdownify }}</li><li>{{ i18n "COPYRIGHT_MESSAGE_2" . | markdownify }}</li></ul>
|
||||
<ul>
|
||||
<li>© {{ .Site.Title }}</li>
|
||||
{{ with i18n "COPYRIGHT_MESSAGE_1" . }}<li>{{ . | markdownify }}</li>{{ end }}
|
||||
{{ with i18n "COPYRIGHT_MESSAGE_2" . }}<li>{{ . | markdownify }}</li>{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,27 @@
|
||||
<title>{{ if eq (.Site.Title) (.Title) }}{{ .Site.Title }}{{ else }}{{ .Title }} · {{ .Site.Title }}{{ end }}</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5" />
|
||||
|
||||
{{ $description := "" }}
|
||||
{{ if .Description }}{{ $description = .Description }}{{ else if .Summary }}{{ $description = .Summary | plainify | truncate 160 }}{{ else }}{{ $description = .Site.Params.description | default "Путешествия и приключения — блог о поездках по России и миру" }}{{ end }}
|
||||
{{ $image := "" }}
|
||||
{{ if .Params.image }}{{ $image = .Params.image | absURL }}{{ else }}{{ $image = (print .Site.BaseURL "images/desktop.webp") }}{{ end }}
|
||||
|
||||
<!-- SEO -->
|
||||
<meta name="description" content="{{ $description }}" />
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
|
||||
<!-- Open Graph (ВКонтакте, Telegram) -->
|
||||
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
|
||||
<meta property="og:title" content="{{ if eq (.Site.Title) (.Title) }}{{ .Site.Title }}{{ else }}{{ .Title }}{{ end }}" />
|
||||
<meta property="og:description" content="{{ $description }}" />
|
||||
<meta property="og:url" content="{{ .Permalink }}" />
|
||||
<meta property="og:site_name" content="{{ .Site.Title }}" />
|
||||
<meta property="og:image" content="{{ $image }}" />
|
||||
<meta property="og:locale" content="ru_RU" />
|
||||
{{ if .IsPage }}
|
||||
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" />
|
||||
{{ end }}
|
||||
<!-- CSS -->
|
||||
{{ if hugo.IsServer }}
|
||||
{{ $style := resources.Get "scss/main.scss" | resources.ExecuteAsTemplate "main.scss" . | toCSS (dict "targetPath" "assets/css/main.css" "enableSourceMap" true) }}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
|
||||
</header>
|
||||
{{ if .Params.image }}
|
||||
<a href="{{ .Permalink }}" class="image main"><img src="{{ .Params.image | relURL }}" alt="" /></a>
|
||||
<a href="{{ .Permalink }}" class="image main"><img src="{{ .Params.image | relURL }}" alt="{{ .Title }}" loading="lazy" /></a>
|
||||
{{ end }}
|
||||
{{ if .Description }}
|
||||
<p>{{ .Description }}</p>
|
||||
|
||||
@@ -1,74 +1,46 @@
|
||||
{{ $paginator := .paginator }}
|
||||
{{ $outer := .outer}}
|
||||
|
||||
<!-- Thanks to https://glennmccomb.com/articles/how-to-build-custom-hugo-pagination/ -->
|
||||
|
||||
<!-- Show first and last link-->
|
||||
{{ $show_first_last := $outer.Site.Params.Posts.showFirstLast | default false }}
|
||||
|
||||
<!-- Number of links either side of the current page. -->
|
||||
{{ $adjacent_links := $outer.Site.Params.Posts.paginationPages | default 2 }}
|
||||
|
||||
<!-- $max_links = ($adjacent_links * 2) + 1 -->
|
||||
{{ $max_links := (add (mul $adjacent_links 2) 1) }}
|
||||
|
||||
<!-- $lower_limit = $adjacent_links + 1 -->
|
||||
{{ $lower_limit := (add $adjacent_links 1) }}
|
||||
|
||||
<!-- $upper_limit = $paginator.TotalPages - $adjacent_links -->
|
||||
{{ $upper_limit := (sub $paginator.TotalPages $adjacent_links) }}
|
||||
|
||||
{{ if gt $paginator.TotalPages 1 }}
|
||||
<footer>
|
||||
<div class="pagination">
|
||||
<ul class="pagination">
|
||||
<nav class="pager" aria-label="Навигация по страницам">
|
||||
<div class="pager-inner">
|
||||
|
||||
<!-- First page. -->
|
||||
{{ if $show_first_last }}
|
||||
{{ if ne $paginator.PageNumber 1 }}
|
||||
<li>
|
||||
<a href="{{ $paginator.First.URL }}" class="extra first">
|
||||
{{ i18n "PAGINATION_FIRST" . }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<!-- Previous page. -->
|
||||
{{ if $paginator.HasPrev }}
|
||||
<li>
|
||||
<a href="{{ $paginator.Prev.URL }}" class="previous">
|
||||
{{ i18n "PAGINATION_PREVIOUS" . }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ if $paginator.HasPrev }}
|
||||
<a href="{{ $paginator.Prev.URL }}" class="pager-btn pager-prev" aria-label="Предыдущая страница">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10 3L5 8L10 13" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<span>Назад</span>
|
||||
</a>
|
||||
{{ else }}
|
||||
<span class="pager-btn pager-prev pager-disabled" aria-disabled="true">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10 3L5 8L10 13" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<span>Назад</span>
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
<!-- Информация о страницах для десктопа -->
|
||||
<li class="page-info desktop-only">
|
||||
<span class="current-page">{{ $paginator.PageNumber }}</span>
|
||||
<span class="separator">из</span>
|
||||
<span class="total-pages">{{ $paginator.TotalPages }}</span>
|
||||
</li>
|
||||
<span class="pager-info" aria-current="page">
|
||||
{{ $paginator.PageNumber }} / {{ $paginator.TotalPages }}
|
||||
</span>
|
||||
|
||||
<!-- Next page. -->
|
||||
{{ if $paginator.HasNext }}
|
||||
<li>
|
||||
<a href="{{ $paginator.Next.URL }}" class="next">
|
||||
{{ i18n "PAGINATION_NEXT" . }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ if $paginator.HasNext }}
|
||||
<a href="{{ $paginator.Next.URL }}" class="pager-btn pager-next" aria-label="Следующая страница">
|
||||
<span>Далее</span>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6 3L11 8L6 13" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</a>
|
||||
{{ else }}
|
||||
<span class="pager-btn pager-next pager-disabled" aria-disabled="true">
|
||||
<span>Далее</span>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6 3L11 8L6 13" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
<!-- Last page. -->
|
||||
{{ if $show_first_last }}
|
||||
{{ if ne $paginator.PageNumber $paginator.TotalPages }}
|
||||
<li>
|
||||
<a href="{{ $paginator.Last.URL }}" class="extra last">
|
||||
{{ i18n "PAGINATION_LAST" . }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</footer>
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ end }}
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
{{ $js := slice $jQuery $scrollex $scrolly $browser $breakpoints $util $main | resources.Concat "assets/js/bundle.js" }}
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src='{{ $js.RelPermalink }}'></script>
|
||||
<script src='{{ $js.RelPermalink }}' defer></script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user