mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2025-07-20 01:42:36 +02:00
updated by original repo
This commit is contained in:
@@ -6,13 +6,13 @@
|
||||
</head>
|
||||
|
||||
<body class="
|
||||
{{- if (or (ne .Kind `page` ) (eq .Layout `archives`)) -}}
|
||||
{{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}}
|
||||
{{- print "list" -}}
|
||||
{{- end -}}
|
||||
{{- if eq $.Site.Params.defaultTheme `dark` -}}
|
||||
{{- print " dark" }}
|
||||
{{- end -}}
|
||||
" id="top">
|
||||
">
|
||||
{{- partialCached "header.html" . .Page}}
|
||||
<main class="main">
|
||||
{{- block "main" . }}
|
||||
|
6
layouts/_default/index.json
Normal file
6
layouts/_default/index.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{{- $.Scratch.Add "index" slice -}}
|
||||
{{- range .Site.RegularPages -}}
|
||||
{{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}}
|
||||
{{- end -}}
|
||||
{{- $.Scratch.Get "index" | jsonify -}}
|
||||
|
@@ -54,10 +54,10 @@
|
||||
<footer class="page-footer">
|
||||
<nav class="pagination">
|
||||
{{- if $paginator.HasPrev }}
|
||||
<a class="prev" href="{{ $paginator.Prev.URL }}">« {{ i18n "prev_page" }}</a>
|
||||
<a class="prev" href="{{ $paginator.Prev.URL | absURL }}">« {{ i18n "prev_page" }}</a>
|
||||
{{- end }}
|
||||
{{- if $paginator.HasNext }}
|
||||
<a class="next" href="{{ $paginator.Next.URL }}">{{ i18n "next_page" }} »</a>
|
||||
<a class="next" href="{{ $paginator.Next.URL | absURL }}">{{ i18n "next_page" }} »</a>
|
||||
{{- end }}
|
||||
</nav>
|
||||
</footer>
|
||||
|
38
layouts/_default/search.html
Normal file
38
layouts/_default/search.html
Normal file
@@ -0,0 +1,38 @@
|
||||
{{- define "main" }}
|
||||
|
||||
<header class="page-header">
|
||||
<h1>{{ .Title }}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none"
|
||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="11" cy="11" r="8"></circle>
|
||||
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
||||
</svg>
|
||||
</h1>
|
||||
{{- if .Params.hideMeta }}{{ else }}
|
||||
<div class="post-meta">
|
||||
{{- if .IsTranslated -}}
|
||||
<ul class="i18n_list">
|
||||
{{- i18n "translations" | default "Translations"}}:
|
||||
{{- range .Translations }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}">
|
||||
{{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }}
|
||||
{{- .Language.LanguageName | emojify | humanize -}}
|
||||
{{- else }}
|
||||
{{- .Lang | humanize -}}
|
||||
{{- end -}}
|
||||
</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- end}}
|
||||
</header>
|
||||
|
||||
<div class="searchbox">
|
||||
<input id="searchInput" autofocus placeholder="{{.Title}} ↵" aria-label="search">
|
||||
<ul id="searchResults" aria-label="search results"></ul>
|
||||
</div>
|
||||
|
||||
{{- end }}{{/* end main */}}
|
@@ -2,4 +2,5 @@
|
||||
<!--
|
||||
to add comments read => https://gohugo.io/content-management/comments/
|
||||
-->
|
||||
{{- template "_internal/disqus.html" . -}}
|
||||
<!-- Comments area end -->
|
@@ -9,7 +9,7 @@
|
||||
<span>·</span>
|
||||
<span>Theme <a href="https://git.io/hugopapermod" rel="noopener" target="_blank">PaperMod</a></span>
|
||||
</footer>
|
||||
<a href="#top" aria-label="go to top" title="Go to Top" accesskey="g">
|
||||
<a aria-label="go to top" title="Go to Top" accesskey="g">
|
||||
<button class="top-link" id="top-link" type="button">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6">
|
||||
<path d="M12 6H0l6-6z" /></svg>
|
||||
@@ -32,15 +32,6 @@
|
||||
document.getElementById('menu').scrollLeft = localStorage.getItem("menu-scroll-position");
|
||||
}
|
||||
}
|
||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
anchor.addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
var id = this.getAttribute("href").substr(1);
|
||||
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView({
|
||||
behavior: "smooth"
|
||||
});
|
||||
});
|
||||
});
|
||||
var mybutton = document.getElementById("top-link");
|
||||
window.onscroll = function () {
|
||||
if (document.body.scrollTop > 800 || document.documentElement.scrollTop > 800) {
|
||||
@@ -51,6 +42,11 @@
|
||||
mybutton.style.opacity = "0";
|
||||
}
|
||||
};
|
||||
mybutton.onclick = function () {
|
||||
document.body.scrollTop = 0;
|
||||
document.documentElement.scrollTop = 0;
|
||||
window.location.hash = ''
|
||||
}
|
||||
|
||||
function menu_on_scroll() {
|
||||
localStorage.setItem("menu-scroll-position", document.getElementById('menu').scrollLeft);
|
||||
|
@@ -29,6 +29,22 @@
|
||||
{{- $stylesheet := (resources.Match "css/*.css") | resources.Concat "assets/css/stylesheet.css" | minify -}}
|
||||
<link href="{{ $stylesheet.Permalink }}" rel="preload stylesheet" as="style">
|
||||
{{- end}}
|
||||
<!-- Search -->
|
||||
{{- if (eq .Layout `search`) -}}
|
||||
<link rel="preload" as="fetch" href="../index.json" crossOrigin="anonymous">
|
||||
{{- $fastsearch := resources.Get "js/fastsearch.js" }}
|
||||
{{- $fusejs := resources.Get "js/fuse.js" }}
|
||||
{{- if not .Site.Params.assets.disableFingerprinting }}
|
||||
{{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify | fingerprint }}
|
||||
<script defer src="{{ $search.Permalink }}" rel="preload" as="script" onload="loadSearch();"
|
||||
integrity="{{ $search.Data.Integrity }}">
|
||||
</script>
|
||||
{{- else}}
|
||||
{{ $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify }}
|
||||
<script defer src="{{ $search.Permalink }}" rel="preload" as="script" onload="loadSearch();"></script>
|
||||
{{- end}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Favicons -->
|
||||
<link rel="icon" href="{{- .Site.Params.assets.favicon | default "favicon.ico" | absURL -}}">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="
|
||||
|
Reference in New Issue
Block a user