-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblog_template.html
More file actions
52 lines (51 loc) · 2.02 KB
/
Copy pathblog_template.html
File metadata and controls
52 lines (51 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{title}} - TOMG DOT COOL</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📝</text></svg>">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700;900&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="/style.css" />
</head>
<body>
<nav>
<div class="container">
<div class="breadcrumbs">{{breadcrumbs}}</div>
</div>
<div class="progress-bar"></div>
</nav>
<script>
const progressBar = document.querySelector('.progress-bar');
window.addEventListener('scroll', () => {
const scrollTop = window.scrollY;
const docHeight = document.documentElement.scrollHeight - window.innerHeight;
const progress = docHeight > 0 ? (scrollTop / docHeight) * 100 : 0;
progressBar.style.width = progress + '%';
});
// Make images clickable to open full size in new tab
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('article img').forEach(img => {
if (img.closest('a')) return; // Skip if already inside a link
const link = document.createElement('a');
link.href = img.src;
link.target = '_blank';
link.className = 'image-link';
// If image is in a figure, wrap the figure; otherwise wrap the image
const figure = img.closest('figure');
const target = figure || img;
target.parentElement.insertBefore(link, target);
link.appendChild(target);
});
});
</script>
<main>
<div class="container">{{content}}</div>
</main>
</body>
</html>