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:
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: adityatelange
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: ['https://www.buymeacoffee.com/adityatelange', 'https://paypal.me/adityatelangepp']
|
@@ -21,7 +21,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.first-entry .entry-header h2 {
|
.first-entry .entry-header h2 {
|
||||||
font-size: 34px
|
font-size: 34px;
|
||||||
|
line-height: 1.3
|
||||||
}
|
}
|
||||||
|
|
||||||
.first-entry .entry-content {
|
.first-entry .entry-content {
|
||||||
|
@@ -5,7 +5,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
-webkit-tap-highlight-color: transparent
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
scroll-behavior: smooth
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (prefers-reduced-motion: reduce) {
|
||||||
|
html {
|
||||||
|
scroll-behavior: auto
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a,
|
a,
|
||||||
|
40
assets/css/search.css
Normal file
40
assets/css/search.css
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
.searchbox input {
|
||||||
|
padding: 4px 10px;
|
||||||
|
width: 100%;
|
||||||
|
color: var(--primary);
|
||||||
|
font-weight: bold;
|
||||||
|
border: 2px solid var(--tertiary);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchbox input:focus {
|
||||||
|
border-color: var(--secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchResults li {
|
||||||
|
list-style: none;
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px 0;
|
||||||
|
position: relative;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchResults {
|
||||||
|
margin: 10px 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchResults li:active {
|
||||||
|
transition: transform .1s;
|
||||||
|
transform: scale(.98);
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchResults a {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
outline: none;
|
||||||
|
}
|
57
assets/js/fastsearch.js
Normal file
57
assets/js/fastsearch.js
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
var fuse; // holds our search engine
|
||||||
|
|
||||||
|
// load our search index, only executed onload
|
||||||
|
function loadSearch() {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.onreadystatechange = function () {
|
||||||
|
if (xhr.readyState === 4) {
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
var data = JSON.parse(xhr.responseText);
|
||||||
|
if (data) {
|
||||||
|
// fuse.js options; check fuse.js website for details
|
||||||
|
var options = {
|
||||||
|
isCaseSensitive: false,
|
||||||
|
shouldSort: true,
|
||||||
|
location: 0,
|
||||||
|
distance: 100,
|
||||||
|
threshold: 0.4,
|
||||||
|
minMatchCharLength: 0,
|
||||||
|
keys: [
|
||||||
|
'title',
|
||||||
|
'permalink',
|
||||||
|
'summary',
|
||||||
|
'content'
|
||||||
|
]
|
||||||
|
};
|
||||||
|
fuse = new Fuse(data, options); // build the index from the json file
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(xhr.responseText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.open('GET', "../index.json");
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
// execute search as each character is typed
|
||||||
|
document.getElementById("searchInput").onkeyup = function (e) {
|
||||||
|
// run a search query (for "term") every time a letter is typed
|
||||||
|
// in the search box
|
||||||
|
const results = fuse.search(this.value); // the actual query being run using fuse.js
|
||||||
|
|
||||||
|
if (results.length !== 0) {
|
||||||
|
// build our html if result exists
|
||||||
|
let resultSet = ''; // our results bucket
|
||||||
|
|
||||||
|
for (let item in results) {
|
||||||
|
resultSet = resultSet + itemGen(results[item].item.title, results[item].item.permalink)
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById("searchResults").innerHTML = resultSet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function itemGen(name, link) {
|
||||||
|
return `<li class="post-entry"><header class="entry-header">${name} »</header><a href="${link}" aria-label="${name}"></a></li>`
|
||||||
|
}
|
2252
assets/js/fuse.js
Normal file
2252
assets/js/fuse.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -6,13 +6,13 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="
|
<body class="
|
||||||
{{- if (or (ne .Kind `page` ) (eq .Layout `archives`)) -}}
|
{{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}}
|
||||||
{{- print "list" -}}
|
{{- print "list" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if eq $.Site.Params.defaultTheme `dark` -}}
|
{{- if eq $.Site.Params.defaultTheme `dark` -}}
|
||||||
{{- print " dark" }}
|
{{- print " dark" }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
" id="top">
|
">
|
||||||
{{- partialCached "header.html" . .Page}}
|
{{- partialCached "header.html" . .Page}}
|
||||||
<main class="main">
|
<main class="main">
|
||||||
{{- block "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">
|
<footer class="page-footer">
|
||||||
<nav class="pagination">
|
<nav class="pagination">
|
||||||
{{- if $paginator.HasPrev }}
|
{{- 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 }}
|
{{- end }}
|
||||||
{{- if $paginator.HasNext }}
|
{{- 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 }}
|
{{- end }}
|
||||||
</nav>
|
</nav>
|
||||||
</footer>
|
</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/
|
to add comments read => https://gohugo.io/content-management/comments/
|
||||||
-->
|
-->
|
||||||
|
{{- template "_internal/disqus.html" . -}}
|
||||||
<!-- Comments area end -->
|
<!-- Comments area end -->
|
@@ -9,7 +9,7 @@
|
|||||||
<span>·</span>
|
<span>·</span>
|
||||||
<span>Theme <a href="https://git.io/hugopapermod" rel="noopener" target="_blank">PaperMod</a></span>
|
<span>Theme <a href="https://git.io/hugopapermod" rel="noopener" target="_blank">PaperMod</a></span>
|
||||||
</footer>
|
</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">
|
<button class="top-link" id="top-link" type="button">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6">
|
||||||
<path d="M12 6H0l6-6z" /></svg>
|
<path d="M12 6H0l6-6z" /></svg>
|
||||||
@@ -32,15 +32,6 @@
|
|||||||
document.getElementById('menu').scrollLeft = localStorage.getItem("menu-scroll-position");
|
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");
|
var mybutton = document.getElementById("top-link");
|
||||||
window.onscroll = function () {
|
window.onscroll = function () {
|
||||||
if (document.body.scrollTop > 800 || document.documentElement.scrollTop > 800) {
|
if (document.body.scrollTop > 800 || document.documentElement.scrollTop > 800) {
|
||||||
@@ -51,6 +42,11 @@
|
|||||||
mybutton.style.opacity = "0";
|
mybutton.style.opacity = "0";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
mybutton.onclick = function () {
|
||||||
|
document.body.scrollTop = 0;
|
||||||
|
document.documentElement.scrollTop = 0;
|
||||||
|
window.location.hash = ''
|
||||||
|
}
|
||||||
|
|
||||||
function menu_on_scroll() {
|
function menu_on_scroll() {
|
||||||
localStorage.setItem("menu-scroll-position", document.getElementById('menu').scrollLeft);
|
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 -}}
|
{{- $stylesheet := (resources.Match "css/*.css") | resources.Concat "assets/css/stylesheet.css" | minify -}}
|
||||||
<link href="{{ $stylesheet.Permalink }}" rel="preload stylesheet" as="style">
|
<link href="{{ $stylesheet.Permalink }}" rel="preload stylesheet" as="style">
|
||||||
{{- end}}
|
{{- 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 -->
|
<!-- Favicons -->
|
||||||
<link rel="icon" href="{{- .Site.Params.assets.favicon | default "favicon.ico" | absURL -}}">
|
<link rel="icon" href="{{- .Site.Params.assets.favicon | default "favicon.ico" | absURL -}}">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="
|
<link rel="icon" type="image/png" sizes="16x16" href="
|
||||||
|
Reference in New Issue
Block a user