Compare commits

...

9 Commits

Author SHA1 Message Date
XUE
9d350812f2
Merge 06eb8a66a12c523297d23a06b376889767a8e80d into f377609ebaa5d0761a31ffc0bbf9a4785d8453aa 2024-12-16 14:38:40 +08:00
Xin
f377609eba docs: update HUGO_VERSION to 0.138.0 in deployment documentation
Some checks are pending
Deploy Hugo site to Pages / build (push) Waiting to run
Deploy Hugo site to Pages / deploy (push) Blocked by required conditions
2024-12-15 20:32:54 +00:00
Xin
a9b992436e chore: update HUGO_VERSION to 0.138.0 in GitHub Actions workflow
* add FUNDING.yml
2024-12-15 20:26:11 +00:00
dependabot[bot]
7f5a7f2f5a
chore(deps-dev): bump cross-spawn from 7.0.3 to 7.0.6 (#515) 2024-12-15 16:33:44 +00:00
dependabot[bot]
30fddec3fa
chore(deps): bump nanoid from 3.3.7 to 3.3.8 (#514)
Some checks are pending
Deploy Hugo site to Pages / build (push) Waiting to run
Deploy Hugo site to Pages / deploy (push) Blocked by required conditions
2024-12-15 14:20:52 +00:00
XUE
06eb8a66a1 fix: reduce the frequency of jittering effect 2024-11-16 17:44:20 +08:00
XUE
081ad8b84f
Merge pull request #1 from imfing/main
update the theme 241104
2024-11-04 10:49:51 +08:00
XUE
7593ef4ae4 fix: add the debouncing and reduce the duplicate writes 2024-11-04 10:29:22 +08:00
XUE
b70d729283 fix: restore the sidebar position to make the selected entry showed 2024-11-03 21:47:31 +08:00
5 changed files with 73 additions and 30 deletions

15
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,15 @@
# These are supported funding model platforms
github: imfing
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
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
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -31,7 +31,7 @@ jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.136.5
HUGO_VERSION: 0.138.0
steps:
- name: Checkout
uses: actions/checkout@v4

View File

@ -1,8 +1,43 @@
document.addEventListener("DOMContentLoaded", function () {
scrollToActiveItem();
enableCollapsibles();
initializeSidebar();
});
function initializeSidebar() {
const sidebarScrollbar = document.querySelector("aside.sidebar-container > .hextra-scrollbar");
if (!sidebarScrollbar) return;
enableCollapsibles();
restoreSidebarPosition(sidebarScrollbar);
const debouncedSave = debounce((position) => {
saveSidebarPosition(position);
}, 150);
sidebarScrollbar.addEventListener('scroll', function() {
debouncedSave(this.scrollTop);
});
document.querySelectorAll('a').forEach(link => {
if (link.hostname === window.location.hostname) {
link.addEventListener('click', function(e) {
saveSidebarPosition(sidebarScrollbar.scrollTop);
});
}
});
}
function debounce(func, wait) {
let timeout;
return function executedFunction(...args) {
const later = () => {
clearTimeout(timeout);
func(...args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}
function enableCollapsibles() {
const buttons = document.querySelectorAll(".hextra-sidebar-collapsible-button");
buttons.forEach(function (button) {
@ -16,21 +51,16 @@ function enableCollapsibles() {
});
}
function scrollToActiveItem() {
const sidebarScrollbar = document.querySelector("aside.sidebar-container > .hextra-scrollbar");
const activeItems = document.querySelectorAll(".sidebar-active-item");
const visibleActiveItem = Array.from(activeItems).find(function (activeItem) {
return activeItem.getBoundingClientRect().height > 0;
});
if (!visibleActiveItem) {
return;
}
const yOffset = visibleActiveItem.clientHeight;
const yDistance = visibleActiveItem.getBoundingClientRect().top - sidebarScrollbar.getBoundingClientRect().top;
sidebarScrollbar.scrollTo({
behavior: "instant",
top: yDistance - yOffset
});
function saveSidebarPosition(scrollPosition) {
localStorage.setItem('sidebarScrollPosition', scrollPosition);
}
function restoreSidebarPosition(sidebarScrollbar) {
const savedPosition = localStorage.getItem('sidebarScrollPosition');
if (savedPosition !== null) {
requestAnimationFrame(() => {
sidebarScrollbar.scrollTop = parseInt(savedPosition);
});
}
}

View File

@ -54,7 +54,7 @@ jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.131.0
HUGO_VERSION: 0.138.0
steps:
- name: Checkout
uses: actions/checkout@v4
@ -146,7 +146,7 @@ For more details, check out:
3. If you are not using [hextra-starter-template][hextra-starter-template], configure the following manually:
- Configure the Build command to `hugo --gc --minify`
- Specify the Publish directory to `public`
- Add Environment variable `HUGO_VERSION` and set to `0.132.2`
- Add Environment variable `HUGO_VERSION` and set to `0.138.0`, or alternatively, set it in `netlify.toml` file
4. Deploy!
Check [Hugo on Netlify](https://docs.netlify.com/integrations/frameworks/hugo/) for more details.

14
package-lock.json generated
View File

@ -523,11 +523,10 @@
}
},
"node_modules/cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true,
"license": "MIT",
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
@ -1031,9 +1030,9 @@
}
},
"node_modules/nanoid": {
"version": "3.3.7",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
"version": "3.3.8",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
"integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
"dev": true,
"funding": [
{
@ -1041,7 +1040,6 @@
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"bin": {
"nanoid": "bin/nanoid.cjs"
},