Skip to content

Commit 8e64ef8

Browse files
authored
Merge pull request #9 from magic-alt/codex/update-blog-post-years-to-2025
Update blog post dates to 2025 and add local visit counter
2 parents a2563e4 + a14193f commit 8e64ef8

File tree

7 files changed

+61
-4
lines changed

7 files changed

+61
-4
lines changed

_includes/footer.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ <h3 class="footer-heading">联系</h3>
2727
<p>&copy; {{ site.time | date: "%Y" }} {{ site.title }} · 借助 Jekyll 与开源主题生态构建</p>
2828
</div>
2929
</footer>
30+
<script src="{{ "/assets/js/visit-tracker.js" | relative_url }}" defer></script>
3031
<script>
3132
(function () {
3233
var storageKey = 'pref-theme';

_layouts/post.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ <h2>写作信息</h2>
4040
<dt>阅读预估</dt>
4141
<dd>约 {{ minutes }} 分钟 · {{ words }} 字</dd>
4242
</div>
43+
<div>
44+
<dt>本地访问次数</dt>
45+
<dd id="page-view-count" data-page-url="{{ page.url | relative_url }}">加载中…</dd>
46+
</div>
4347
</dl>
4448
</div>
4549
<div class="post-aside-card">

_posts/2024-01-01-welcome.md renamed to _posts/2025-01-01-welcome.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 欢迎来到 Kaermaxc 博客
3-
date: 2024-01-01 10:00:00 +0800
3+
date: 2025-01-01 10:00:00 +0800
44
tags: [Jekyll, 教程]
55
excerpt: "从零开始搭建 GitHub Pages 博客的完整流程,以及我为本站打造的 Aurora 夜空主题设计思路。"
66
---

_posts/2024-04-15-motor-control-foundations.md renamed to _posts/2025-04-15-motor-control-foundations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 永磁同步电机控制与性能评估实战
3-
date: 2024-04-15 09:30:00 +0800
3+
date: 2025-04-15 09:30:00 +0800
44
tags: [电机控制, 控制理论, STM32]
55
excerpt: "从性能指标、参数辨识、FOC 实现到 PI 整定与排错的完整闭环;附 STM32 实操清单、调参流程与示例数据表。"
66
layout: post

_posts/2024-10-17-neovim-cpp-setup.md renamed to _posts/2025-10-17-neovim-cpp-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 打造高效 Neovim C/C++ 开发环境:从零到一的完整指南
3-
date: 2024-10-17 10:00:00 +0800
3+
date: 2025-10-17 10:00:00 +0800
44
tags: [Neovim, C++, 开发环境, LSP]
55
excerpt: "用 clangd + Treesitter 打造 IDE 级体验,覆盖补全/诊断/调试/格式化/构建;修正 GDB/Lldb 适配,提供 Windows 与 CMake 指南。"
66
layout: post

_posts/2024-10-30-harmonic-drive-summary.md renamed to _posts/2025-10-27-harmonic-drive-summary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: post
33
title: "谐波减速机学习总结"
4-
date: 2024-10-30 00:00:00 +0800
4+
date: 2025-10-27 00:00:00 +0800
55
categories: 技术
66
tags: [谐波减速机, 传动, 机械设计]
77
excerpt: 汇总谐波减速机的工作原理、性能特性、关键计数参数与选型应用要点,便于快速查阅与工程实践。

assets/js/visit-tracker.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
(function () {
2+
'use strict';
3+
4+
var viewElement = document.getElementById('page-view-count');
5+
if (!viewElement) {
6+
return;
7+
}
8+
9+
if (!('localStorage' in window)) {
10+
viewElement.textContent = '暂不可用(浏览器不支持本地存储)';
11+
return;
12+
}
13+
14+
var storageKey = 'kaermaxc-visit-counts';
15+
var pageId = viewElement.getAttribute('data-page-url') || window.location.pathname;
16+
17+
function readCounts() {
18+
try {
19+
var raw = localStorage.getItem(storageKey);
20+
if (!raw) {
21+
return {};
22+
}
23+
var parsed = JSON.parse(raw);
24+
if (typeof parsed === 'object' && parsed) {
25+
return parsed;
26+
}
27+
} catch (error) {
28+
console.warn('无法从本地存储读取访问数据', error);
29+
}
30+
return {};
31+
}
32+
33+
function writeCounts(counts) {
34+
try {
35+
localStorage.setItem(storageKey, JSON.stringify(counts));
36+
return true;
37+
} catch (error) {
38+
console.warn('无法将访问数据写入本地存储', error);
39+
return false;
40+
}
41+
}
42+
43+
var counts = readCounts();
44+
var current = counts[pageId] || 0;
45+
current += 1;
46+
counts[pageId] = current;
47+
if (writeCounts(counts)) {
48+
viewElement.textContent = current + ' 次(仅记录本设备)';
49+
} else {
50+
viewElement.textContent = '暂不可用(浏览器禁用了本地存储)';
51+
}
52+
})();

0 commit comments

Comments
 (0)