Skip to content

Commit c9d1eea

Browse files
authored
feat: change footer, add archive page (#11)
* add a GitHub link to a ru version of the blog * setup blog footer * add `archives` menu item, move `search` to locale folder
1 parent 3d5984f commit c9d1eea

File tree

9 files changed

+178
-19
lines changed

9 files changed

+178
-19
lines changed

config.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,18 @@ languages:
3737
Title: "Добро пожаловать в блог BinaryCascade"
3838
Content: "Заметки и прочее от BinaryCascade"
3939
socialIcons:
40-
- name: "other"
41-
title: "@tembeon канал в Telegram"
40+
- name: "github"
41+
title: "Наш GitHub"
42+
url: "https://github.com/BinaryCascade"
43+
- name: "telegram"
44+
title: "Канал tem_notes"
4245
url: "https://t.me/tembeon_notes"
4346

4447
# Прочее
4548
editPost:
4649
Text: "Предложить изменения"
4750

48-
title: "BinaryCascade blog"
51+
title: "BinaryCascade"
4952
theme: PaperMod
5053

5154
# Site config
@@ -118,6 +121,10 @@ menu:
118121
name: tags
119122
url: /tags/
120123
weight: 20
124+
- identifier: archives
125+
name: archives
126+
url: /archives
127+
weight: 5
121128

122129
pygmentsUseClasses: true
123130
markup:

content/en/archives.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: "Archive"
3+
layout: "archives"
4+
summary: archives
5+
---
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: "File nesting"
3+
date: 2024-02-08T21:44:24+03:00
4+
draft: true
5+
tags: [ "IDE", "IntelliJ IDEA", "VS Code", ]
6+
author: "Tembeon"
7+
showToc: true
8+
TocOpen: true
9+
UseHugoToc: true
10+
cover:
11+
image: "/articles/file_nesting/cover.png"
12+
alt: "File nesting article cover"
13+
relative: true
14+
---
15+
16+
Empty file for now.

content/en/search.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "Search"
3+
layout: "search"
4+
summary: "search"
5+
placeholder: "Start typing"
6+
---

content/ru/archives.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: "Архив"
3+
layout: "archives"
4+
summary: archives
5+
---

content/ru/search.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "Поиск"
3+
layout: "search"
4+
summary: "search"
5+
placeholder: "Начните писать"
6+
---

content/search.en.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

content/search.ru.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

layouts/partials/footer.html

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
{{- if not (.Param "hideFooter") }}
2+
<footer class="footer">
3+
{{- if site.Copyright }}
4+
<span>{{ site.Copyright | markdownify }}</span>
5+
{{- else }}
6+
<span>&copy; {{ now.Year }} <a href="{{ "" | absLangURL }}">{{ site.Title }}</a></span>
7+
{{- end }}
8+
</footer>
9+
{{- end }}
10+
11+
{{- if (not site.Params.disableScrollToTop) }}
12+
<a href="#top" aria-label="go to top" title="Go to Top (Alt + G)" class="top-link" id="top-link" accesskey="g">
13+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentColor">
14+
<path d="M12 6H0l6-6z" />
15+
</svg>
16+
</a>
17+
{{- end }}
18+
19+
{{- partial "extend_footer.html" . }}
20+
21+
<script>
22+
let menu = document.getElementById('menu')
23+
if (menu) {
24+
menu.scrollLeft = localStorage.getItem("menu-scroll-position");
25+
menu.onscroll = function () {
26+
localStorage.setItem("menu-scroll-position", menu.scrollLeft);
27+
}
28+
}
29+
30+
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
31+
anchor.addEventListener("click", function (e) {
32+
e.preventDefault();
33+
var id = this.getAttribute("href").substr(1);
34+
if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
35+
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView({
36+
behavior: "smooth"
37+
});
38+
} else {
39+
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView();
40+
}
41+
if (id === "top") {
42+
history.replaceState(null, null, " ");
43+
} else {
44+
history.pushState(null, null, `#${id}`);
45+
}
46+
});
47+
});
48+
49+
</script>
50+
51+
{{- if (not site.Params.disableScrollToTop) }}
52+
<script>
53+
var mybutton = document.getElementById("top-link");
54+
window.onscroll = function () {
55+
if (document.body.scrollTop > 800 || document.documentElement.scrollTop > 800) {
56+
mybutton.style.visibility = "visible";
57+
mybutton.style.opacity = "1";
58+
} else {
59+
mybutton.style.visibility = "hidden";
60+
mybutton.style.opacity = "0";
61+
}
62+
};
63+
64+
</script>
65+
{{- end }}
66+
67+
{{- if (not site.Params.disableThemeToggle) }}
68+
<script>
69+
document.getElementById("theme-toggle").addEventListener("click", () => {
70+
if (document.body.className.includes("dark")) {
71+
document.body.classList.remove('dark');
72+
localStorage.setItem("pref-theme", 'light');
73+
} else {
74+
document.body.classList.add('dark');
75+
localStorage.setItem("pref-theme", 'dark');
76+
}
77+
})
78+
79+
</script>
80+
{{- end }}
81+
82+
{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (.Param "ShowCodeCopyButtons")) }}
83+
<script>
84+
document.querySelectorAll('pre > code').forEach((codeblock) => {
85+
const container = codeblock.parentNode.parentNode;
86+
87+
const copybutton = document.createElement('button');
88+
copybutton.classList.add('copy-code');
89+
copybutton.innerHTML = '{{- i18n "code_copy" | default "copy" }}';
90+
91+
function copyingDone() {
92+
copybutton.innerHTML = '{{- i18n "code_copied" | default "copied!" }}';
93+
setTimeout(() => {
94+
copybutton.innerHTML = '{{- i18n "code_copy" | default "copy" }}';
95+
}, 2000);
96+
}
97+
98+
copybutton.addEventListener('click', (cb) => {
99+
if ('clipboard' in navigator) {
100+
navigator.clipboard.writeText(codeblock.textContent);
101+
copyingDone();
102+
return;
103+
}
104+
105+
const range = document.createRange();
106+
range.selectNodeContents(codeblock);
107+
const selection = window.getSelection();
108+
selection.removeAllRanges();
109+
selection.addRange(range);
110+
try {
111+
document.execCommand('copy');
112+
copyingDone();
113+
} catch (e) { };
114+
selection.removeRange(range);
115+
});
116+
117+
if (container.classList.contains("highlight")) {
118+
container.appendChild(copybutton);
119+
} else if (container.parentNode.firstChild == container) {
120+
// td containing LineNos
121+
} else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "TABLE") {
122+
// table containing LineNos and code
123+
codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(copybutton);
124+
} else {
125+
// code blocks not having highlight as parent class
126+
codeblock.parentNode.appendChild(copybutton);
127+
}
128+
});
129+
</script>
130+
{{- end }}

0 commit comments

Comments
 (0)