Compare commits

...

26 Commits

Author SHA1 Message Date
Xin
38c8ee1168 fix: mermaid script was skipped on home page (#637) 2025-03-27 22:40:24 +00:00
Xin
17de708c9f chore(build): build main docs site from v0.9.6 2025-03-27 22:23:38 +00:00
Xin
a338c363ed chore(ci): add support for building docs for multiple versions (#633)
* chore(ci): add support for building docs for multiple versions

* chore(ci): enable fetching tags in GitHub Actions workflow

* chore(build): add v0.8.6 version to build script
2025-03-26 21:55:31 +00:00
c3ce3b67e6 docs(showcase): Added Clace to showcase (#623) 2025-03-23 10:12:13 +00:00
Xin
9d57dbd9cd chore: update hugo to 0.145.0 in devcontainer.json
[skip ci]
2025-03-11 21:43:41 +00:00
Xin
a2718d8aa3 fix: use InnerDeindent for filetree shortcode rendering (#613) 2025-03-11 21:42:16 +00:00
Xin
2b83a3762f Merge pull request #607 from maxbischoff/fix-codeblock-copy-button-in-details
fix: copy-button not being rendered in details blocks
2025-03-10 23:05:43 +00:00
aad859d72e fix copy-button not being rendered in details blocks 2025-03-10 20:12:30 +01:00
6a2f11d780 fix: sidebar more menu item link with multilingual (#594)
* sidebar: fix more menu item with multilingual

Fixes #593

Correctly parses multilingual URL in sidebar, particularly if
lang code follows a nested sub directory.

For instance, GH pages hosting where the baseurl might be of the
format `https://<USERNAME>.github.io/<REPO>/`.

* Update sidebar.html

---------

Co-authored-by: Xin <xin@imfing.com>
2025-03-01 08:39:36 +00:00
Xin
662d9202dc chore: bump minimum hugo version 2025-02-26 23:33:11 +00:00
Xin
9f9ddd69ab fix: sanitize heading title to prevent html tags displayed on mobile (#591) 2025-02-26 23:26:21 +00:00
Xin
96b2f6145d feat: add optional pagination control for blog articles (#590) 2025-02-26 23:13:43 +00:00
Xin
c2286c9dd1 refactor: modularize scripts partial into separate components (#587)
* refactor: modularize scripts partial into separate components

* fix: conditionally load Mermaid and KaTeX scripts
2025-02-26 08:39:26 +00:00
Xin
49b1cd11ee feat: hide navbar on mobile when heading links clicked (#584) 2025-02-25 18:48:25 +00:00
Xin
b2e6c30c7f chore: remove unused hx-mx-2 margin utility class 2025-02-25 08:12:44 +00:00
8eb348323d docs: fix typo in documentation on customization.md (#582) 2025-02-23 10:06:25 +00:00
ab56c66ae5 fix: misaligned page title when logo is not displayed (#578) 2025-02-17 17:15:35 +00:00
ddc017b8dc docs: mention Hugo Figure shortcode (#572) 2025-02-13 11:22:41 +08:00
ce837dca42 docs(showcase): add Regolith Desktop (#568) 2025-02-13 11:21:59 +08:00
c60d1f5de7 docs: describe page last modification date (#562) 2025-01-23 20:58:03 +00:00
bbe3c46320 chore: add telegram icon (#558)
* Update icons.yaml | add telegram icon

* chore: update telegram icon

---------

Co-authored-by: Xin <xin@imfing.com>
2025-01-21 21:57:43 +00:00
cb3373d500 fix: missing doctype error on 404 page with htmltest scan (#554)
* Fix missing doctype error on 404 page with htmltest scan

* format 404.html

---------

Co-authored-by: Xin <xin@imfing.com>
2025-01-19 19:35:24 +00:00
Xin
56f28e6f14 chore: 2024 -> 2025 2025-01-19 11:50:14 +00:00
Xin
14036ffea6 feat: enhance FlexSearch encoding for CJK support (#553)
- Added support for CJK (Chinese, Japanese, Korean) languages in FlexSearch encoding.
- Introduced `isCJK` function to detect language and select appropriate encoding method.
- Implemented `encodeCJK` and `encodeDefault` functions for different tokenization strategies.
2025-01-18 18:54:54 +00:00
a1232ecf9f fix: skip image process on svgs and remote images (#551) 2025-01-18 17:05:13 +00:00
a933f464f5 docs: fix wrong param footer (#543)
it has changed 709a407b2e/layouts/partials/footer.html (L40C40-L40C56)
2025-01-07 10:51:00 +00:00
48 changed files with 353 additions and 196 deletions

View File

@ -3,7 +3,7 @@
"features": {
"ghcr.io/devcontainers/features/hugo:1": {
"extended": true,
"version": "0.131.0"
"version": "0.145.0"
},
"ghcr.io/devcontainers/features/node:1": {}
},

View File

@ -1,5 +1,5 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages
# Build and deploy Hextra docs site to GitHub Pages
name: Deploy Hextra docs site to Pages
on:
# Runs on pushes targeting the default branch
@ -31,39 +31,43 @@ jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.138.0
HUGO_VERSION: 0.145.0
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history for .GitInfo and .Lastmod
fetch-depth: 0 # fetch all history for .GitInfo and .Lastmod
fetch-tags: true
submodules: recursive
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: "1.24"
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Setup Hugo
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Build with Hugo
- name: Make build script executable
run: chmod +x ./build.sh
- name: Build all site versions
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
# Use the latest release of the theme to build exampleSite
run: |
cd exampleSite && rm go.mod
hugo mod init github.com/imfing/hextra/exampleSite
hugo mod get -u github.com/imfing/hextra
hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
./build.sh "${{ steps.pages.outputs.base_url }}"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./exampleSite/public
path: ./public
# Deployment job
deploy:

View File

@ -584,10 +584,6 @@ video {
margin-left: 0.25rem;
margin-right: 0.25rem;
}
.hx-mx-2 {
margin-left: 0.5rem;
margin-right: 0.5rem;
}
.hx-mx-4 {
margin-left: 1rem;
margin-right: 1rem;

View File

@ -195,8 +195,19 @@ document.addEventListener("DOMContentLoaded", function () {
*/
async function preloadIndex() {
const tokenize = '{{- site.Params.search.flexsearch.tokenize | default "forward" -}}';
const isCJK = () => {
const lang = document.documentElement.lang || "en";
return lang.startsWith("zh") || lang.startsWith("ja") || lang.startsWith("ko");
}
const encodeCJK = (str) => str.replace(/[\x00-\x7F]/g, "").split("");
const encodeDefault = (str) => (""+str).toLocaleLowerCase().split(/[\p{Z}\p{S}\p{P}\p{C}]+/u);
const encodeFunction = isCJK() ? encodeCJK : encodeDefault;
window.pageIndex = new FlexSearch.Document({
tokenize,
encode: encodeFunction,
cache: 100,
document: {
id: 'id',
@ -207,6 +218,7 @@ document.addEventListener("DOMContentLoaded", function () {
window.sectionIndex = new FlexSearch.Document({
tokenize,
encode: encodeFunction,
cache: 100,
document: {
id: 'id',

View File

@ -23,6 +23,12 @@ document.addEventListener('DOMContentLoaded', function () {
document.body.classList.toggle('md:hx-overflow-auto');
}
function hideOverlay() {
// Hide the overlay
overlay.classList.remove(...overlayClasses);
overlay.classList.add('hx-bg-transparent');
}
menu.addEventListener('click', (e) => {
e.preventDefault();
toggleMenu();
@ -33,8 +39,7 @@ document.addEventListener('DOMContentLoaded', function () {
overlay.classList.remove('hx-bg-transparent');
} else {
// Hide the overlay
overlay.classList.remove(...overlayClasses);
overlay.classList.add('hx-bg-transparent');
hideOverlay();
}
});
@ -43,7 +48,23 @@ document.addEventListener('DOMContentLoaded', function () {
toggleMenu();
// Hide the overlay
overlay.classList.remove(...overlayClasses);
overlay.classList.add('hx-bg-transparent');
hideOverlay();
});
// Select all anchor tags in the sidebar container
const sidebarLinks = sidebarContainer.querySelectorAll('a');
// Add click event listener to each anchor tag
sidebarLinks.forEach(link => {
link.addEventListener('click', (e) => {
// Check if the href attribute contains a hash symbol (links to a heading)
if (link.getAttribute('href') && link.getAttribute('href').startsWith('#')) {
// Only dismiss overlay on mobile view
if (window.innerWidth < 768) {
toggleMenu();
hideOverlay();
}
}
});
});
});

55
build.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
set -e
# Specify the base URL
BASE_URL=${1:-"http://localhost:1313"}
echo "Using base URL: $BASE_URL"
# Version configuration - modify these arrays to specify versions to build
# Format: "ref:display_name" (ref can be tag, branch, or commit hash, display name is what will appear in URL)
MAIN_VERSION="v0.9.6:latest"
VERSIONS=(
"main:latest" # latest version always builds from main
"v0.9.6:v0.9"
"v0.8.6:v0.8"
)
# Parse main version
IFS=':' read -r MAIN_REF MAIN_NAME <<< "$MAIN_VERSION"
# Ensure clean public directory
rm -rf public
mkdir -p public
mkdir -p public/versions
# Checkout and build main site
git checkout $MAIN_REF
GIT_HASH=$(git rev-parse --short HEAD)
echo "Building main site from $MAIN_REF (commit: $GIT_HASH)"
hugo \
--minify \
--themesDir=../.. --source=exampleSite \
--baseURL "$BASE_URL/" \
--destination=../public
# Build all versions
for VERSION in "${VERSIONS[@]}"; do
IFS=':' read -r REF NAME <<< "$VERSION"
git checkout $REF
GIT_HASH=$(git rev-parse --short HEAD)
echo "Building version $NAME from $REF (commit: $GIT_HASH)"
mkdir -p "public/versions/$NAME"
hugo \
--minify \
--themesDir=../.. --source=exampleSite \
--baseURL "$BASE_URL/versions/$NAME/" \
--destination="../public/versions/$NAME"
done
# Return to main branch
git checkout main
echo "Build completed"

View File

@ -290,3 +290,4 @@ x-twitter: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path f
linkedin: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037c-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85c3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065a2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>
slack: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52a2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52zm0 1.271a2.528 2.528 0 0 1 2.521 2.521a2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521zm10.122 2.521a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522zm-1.268 0a2.528 2.528 0 0 1-2.523 2.521a2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522zm-2.523 10.122a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522zm0-1.268a2.527 2.527 0 0 1-2.52-2.523a2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523z" /></svg>
bluesky: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 530"><path fill="currentColor" d="M136 44c66 50 138 151 164 205 26-54 98-155 164-205 48-36 126-64 126 25 0 18-10 149-16 170-21 74-96 93-163 81 117 20 147 86 82 153-122 125-176-32-189-72-3-8-4-11-4-8 0-3-1 0-4 8-13 40-67 197-189 72-65-67-35-133 82-153-67 12-142-7-163-81-6-21-16-152-16-170 0-89 78-61 126-25z"/></svg>
telegram: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M248 8C111.033 8 0 119.033 0 256s111.033 248 248 248 248-111.033 248-248S384.967 8 248 8m114.952 168.66c-3.732 39.215-19.881 134.378-28.1 178.3-3.476 18.584-10.322 24.816-16.948 25.425-14.4 1.326-25.338-9.517-39.287-18.661-21.827-14.308-34.158-23.215-55.346-37.177-24.485-16.135-8.612-25 5.342-39.5 3.652-3.793 67.107-61.51 68.335-66.746.153-.655.3-3.1-1.154-4.384s-3.59-.849-5.135-.5q-3.283.746-104.608 69.142-14.845 10.194-26.894 9.934c-8.855-.191-25.888-5.006-38.551-9.123-15.531-5.048-27.875-7.717-26.8-16.291q.84-6.7 18.45-13.7 108.446-47.248 144.628-62.3c68.872-28.647 83.183-33.623 92.511-33.789 2.052-.034 6.639.474 9.61 2.885a10.45 10.45 0 0 1 3.53 6.716 43.8 43.8 0 0 1 .417 9.769"/></svg>

View File

@ -145,7 +145,7 @@ The following classes can be used to customize various parts of the theme.
- `theme-toggle` - The theme toggle button
#### Cody Copy Button
#### Code Copy Button
- `hextra-code-copy-btn-container` - The code copy button container
- `hextra-code-copy-btn` - The code copy button
@ -195,7 +195,7 @@ You can add extra section in the footer by creating a file `layouts/partials/cus
The added section will be added before the copyright section in the footer.
You can use [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML) and [Hugo template syntax](https://gohugo.io/templates/) to add your own content.
Hugo variables available in the footer section are: `.switchesVisible` and `.copyrightVisible`.
Hugo variables available in the footer section are: `.switchesVisible` and `.displayCopyright`.
## Custom Layouts

View File

@ -212,6 +212,22 @@ Options for `theme.default`:
The `theme.displayToggle` parameter allows you to display a toggle button for changing themes.
When set to `true`, visitors can switch between light or dark mode, overriding the default setting.
### Page Last Modification
The date of the page's last modification can be displayed by enabling the `params.displayUpdatedDate` flag. To use Git commit date as the source, enable also the `enableGitInfo` flag.
To customize the date format, set the `params.dateFormat` parameter. Its layout matches Hugo's [`time.Format`](https://gohugo.io/functions/time/format/).
```yaml {filename="hugo.yaml"}
# Parse Git commit
enableGitInfo: true
params:
# Display the last modification date
displayUpdatedDate: true
dateFormat: "January 2, 2006"
```
### Page Width
The width of the page can be customized by the `params.page.width` parameter in the config file:

View File

@ -171,6 +171,8 @@ With caption:
![landscape](https://picsum.photos/800/600 "Unsplash Landscape")
```
For more advanced functionality, use Hugo's built-in [Figure shortcode](https://gohugo.io/shortcodes/figure/).
## Configuration
Hugo uses [Goldmark](https://github.com/yuin/goldmark) for Markdown parsing.

View File

@ -12,6 +12,20 @@ Open source projects powered by Hextra
</p>
{{< cards >}}
{{< card
link="https://github.com/claceio/clace"
title="Clace"
image="https://github.com/user-attachments/assets/55de142c-eb21-4402-81db-bc64417eaae2"
imageStyle="object-fit:cover; aspect-ratio:16/9;"
>}}
{{< card
link="https://github.com/regolith-linux/regolith-desktop.com"
title="Regolith Desktop"
image="https://github.com/user-attachments/assets/4bbedd7d-67ef-4363-91f1-acb4a0c5f8d0"
imageStyle="object-fit:cover; aspect-ratio:16/9;"
>}}
{{< card
link="https://github.com/modelcontextprotocol/specification"
title="Model Context Protocol Specification"

View File

@ -3,6 +3,7 @@ baseURL: "https://example.com/"
title: "Hextra"
enableRobotsTXT: true
# Parse Git commit
enableGitInfo: true
# enableEmoji: false
hasCJKLanguage: true
@ -42,7 +43,7 @@ languages:
module:
hugoVersion:
extended: true
min: "0.112.0"
min: "0.134.0"
workspace: hugo.work
imports:
@ -135,6 +136,7 @@ params:
displayPoweredBy: true
width: normal
# Display the last modification date
displayUpdatedDate: true
dateFormat: "January 2, 2006"
@ -161,6 +163,9 @@ params:
# date | lastmod | publishDate | title | weight
sortBy: date
sortOrder: desc # or "asc"
article:
displayPagination: true
highlight:
copy:

View File

@ -406,7 +406,6 @@
"hx-mt-6",
"hx-mt-8",
"hx-mx-1",
"hx-mx-2",
"hx-mx-4",
"hx-mx-auto",
"hx-my-1.5",

View File

@ -2,7 +2,7 @@ backToTop: "Zpět nahoru"
changeLanguage: "Změnit jazyk"
changeTheme: "Změnit vzhled"
copyCode: "Zkopírovat kód"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "Tmavý"
editThisPage: "Upravit tuto stránku na GitHubu →"
lastUpdated: "Naposledy změněno"

View File

@ -2,7 +2,7 @@ backToTop: "Nach oben"
changeLanguage: "Sprache ändern"
changeTheme: "Darstellung ändern"
copyCode: "Code kopieren"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "Dunkel"
editThisPage: "Diese Seite auf GitHub bearbeiten →"
lastUpdated: "Zuletzt aktualisiert am"

View File

@ -2,7 +2,7 @@ backToTop: "Scroll to top"
changeLanguage: "Change language"
changeTheme: "Change theme"
copyCode: "Copy code"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "Dark"
editThisPage: "Edit this page on GitHub →"
lastUpdated: "Last updated on"

View File

@ -1,7 +1,7 @@
backToTop: "Subir al inicio"
changeLanguage: "Cambiar idioma"
changeTheme: "Cambiar tema"
copyright: "© 2024 Proyecto Hextra."
copyright: "© 2025 Proyecto Hextra."
dark: "Oscuro"
editThisPage: "Edita esta página en GitHub →"
lastUpdated: "Última actualización"

View File

@ -1,7 +1,7 @@
backToTop: "Revenir en haut"
changeLanguage: "Changer la langue"
changeTheme: "Thème d'affichage"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "Sombre"
editThisPage: "Modifier cette page sur GitHub →"
lastUpdated: "Dernière modification"

View File

@ -2,7 +2,7 @@ backToTop: "גלול למעלה"
changeLanguage: "שנה שפה"
changeTheme: "שנה ערכת צבעים"
copyCode: "העתק קוד"
copyright: "© 2024 פרוייקט Hextra"
copyright: "© 2025 פרוייקט Hextra"
dark: "כהה"
editThisPage: "← ערוך עמוד זה בגיטהאב"
lastUpdated: "עודכן לאחרונה ב"

View File

@ -1,7 +1,7 @@
backToTop: "トップにスクロール"
changeLanguage: "言語を変更"
changeTheme: "テーマを変更"
copyright: "© 2024 Hextra プロジェクト。"
copyright: "© 2025 Hextra プロジェクト。"
dark: "ダーク"
editThisPage: "このページをGitHubで編集 →"
lastUpdated: "最終更新日"

View File

@ -1,7 +1,7 @@
backToTop: "맨위로 스크롤"
changeLanguage: "언어변경"
changeTheme: "테마변경"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "어두운 테마"
editThisPage: "GitHub에서 편집하기 →"
lastUpdated: "마지막 수정일자"

View File

@ -1,7 +1,7 @@
backToTop: "Gå til toppen"
changeLanguage: "Endre språk"
changeTheme: "Endre tema"
copyright: "© 2024 Hextra-prosjektet."
copyright: "© 2025 Hextra-prosjektet."
dark: "Mørk"
editThisPage: "Rediger denne siden på GitHub →"
lastUpdated: "Sist oppdatert"

View File

@ -2,7 +2,7 @@ backToTop: "Terug naar boven"
changeLanguage: "Taal veranderen"
changeTheme: "Thema aanpassen"
copyCode: "Kopieer code"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "Donker"
editThisPage: "Bewerk deze pagina op GitHub →"
lastUpdated: "Laatst bijgewerkt op"

View File

@ -1,7 +1,7 @@
backToTop: "Gå til toppen"
changeLanguage: "Endre språk"
changeTheme: "Endre tema"
copyright: "© 2024 Hextra-prosjektet."
copyright: "© 2025 Hextra-prosjektet."
dark: "Mørk"
editThisPage: "Rediger denne sida på GitHub →"
lastUpdated: "Sist oppdatert"

View File

@ -1,7 +1,7 @@
backToTop: "Voltar ao topo"
changeLanguage: "Mudar a língua"
changeTheme: "Mudar tema"
copyright: "© 2024 Projecto Hextra."
copyright: "© 2025 Projecto Hextra."
dark: "Escuro"
editThisPage: "Edita esta página no GitHub →"
lastUpdated: "Última modificação"

View File

@ -2,7 +2,7 @@ backToTop: "Înapoi sus"
changeLanguage: "Schimbă limba"
changeTheme: "Schimbă tema"
copyCode: "Copiază codul"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "Întuneric"
editThisPage: "Editați această pagină pe GitHub ←"
lastUpdated: "Ultima actualizare la"
@ -11,4 +11,4 @@ noResultsFound: "Nici un rezultat găsit."
onThisPage: "Pe această pagină"
poweredBy: "Susținut de Hextra"
readMore: "Citește mai mult ←"
searchPlaceholder: "Caută..."
searchPlaceholder: "Caută..."

View File

@ -2,7 +2,7 @@ backToTop: 'Прокрутить к началу'
changeLanguage: 'Изменить язык'
changeTheme: 'Изменить тему'
copyCode: 'Скопировать код'
copyright: '2024 Проект Hextra.'
copyright: '2025 Проект Hextra.'
dark: 'Темная'
editThisPage: 'Отредактировать страницу на GitHub →'
lastUpdated: 'Последнее обновление'

View File

@ -1,7 +1,7 @@
backToTop: "Tembeza hadi juu"
changeLanguage: "Badilisha lugha"
changeTheme: "Badilisha mandhari"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "Meusi"
editThisPage: "Hariri ukurasa huu kwenye GitHub →"
lastUpdated: "Ilisasishwa mwisho"

View File

@ -2,7 +2,7 @@ backToTop: "Прокрутити до початку"
changeLanguage: "Змінити мову"
changeTheme: "Змінити тему"
copyCode: "Скопіювати код"
copyright: "2024 Проєкт Hextra."
copyright: "2025 Проєкт Hextra."
dark: "Темна"
editThisPage: "Редагувати цю сторінку на GitHub →"
lastUpdated: "Востаннє оновлено"

View File

@ -1,7 +1,7 @@
backToTop: "Lướt lên đầu trang"
changeLanguage: "Đổi ngôn ngữ"
changeTheme: "Đổi chủ đề"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "Tối"
editThisPage: "Sửa trang này trên GitHub →"
lastUpdated: "Lần cuối cập nhật lúc"

View File

@ -1,7 +1,7 @@
backToTop: "返回顶部"
changeLanguage: "切换语言"
changeTheme: "切换主题"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "深色"
editThisPage: "在 GitHub 上编辑此页 →"
lastUpdated: "最后更新于"

View File

@ -1,7 +1,7 @@
backToTop: "返回頂部"
changeLanguage: "切換語言"
changeTheme: "切換主題"
copyright: "© 2024 Hextra Project."
copyright: "© 2025 Hextra Project."
dark: "深色"
editThisPage: "在 GitHub 上編輯此頁 →"
lastUpdated: "最後更新於"

View File

@ -1,27 +1,39 @@
<div style='font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"; height:100vh; text-align:center; display:flex; flex-direction:column; align-items:center; justify-content:center'>
<div>
<style>
body {
color: #000;
background: #fff;
margin: 0;
}
.next-error-h1 {
border-right: 1px solid rgba(0, 0, 0, 0.3);
}
@media (prefers-color-scheme: dark) {
body {
color: #fff;
background: #000;
}
.next-error-h1 {
border-right: 1px solid rgba(255, 255, 255, 0.3);
}
}
</style>
<h1 class="next-error-h1" style='display: inline-block; margin: 0 20px 0 0; padding-right: 23px; font-size: 24px; font-weight: 500; vertical-align: top; line-height: 49px; font-feature-settings: "rlig" 1,"calt" 1,"ss01" 1,"ss06" 1 !important;'>404</h1>
<div style="display: inline-block; text-align: left">
<h2 style="font-size: 14px; font-weight: 400; line-height: 49px; margin: 0">This page could not be found.</h2>
<!DOCTYPE html>
<html lang="en">
<body
style='font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"; height:100vh; text-align:center; display:flex; flex-direction:column; align-items:center; justify-content:center'>
<div>
<style>
body {
color: #000;
background: #fff;
margin: 0;
}
.next-error-h1 {
border-right: 1px solid rgba(0, 0, 0, 0.3);
}
@media (prefers-color-scheme: dark) {
body {
color: #fff;
background: #000;
}
.next-error-h1 {
border-right: 1px solid rgba(255, 255, 255, 0.3);
}
}
</style>
<h1 class="next-error-h1"
style='display: inline-block; margin: 0 20px 0 0; padding-right: 23px; font-size: 24px; font-weight: 500; vertical-align: top; line-height: 49px; font-feature-settings: "rlig" 1,"calt" 1,"ss01" 1,"ss06" 1 !important;'>
404</h1>
<div style="display: inline-block; text-align: left">
<h2 style="font-size: 14px; font-weight: 400; line-height: 49px; margin: 0">This page could not be found.
</h2>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,4 +1,4 @@
<pre class="mermaid hx-mt-6">
{{- .Inner | safeHTML -}}
{{ .Inner | htmlEscape | safeHTML }}
</pre>
{{- .Page.Store.Set "hasMermaid" true -}}

View File

@ -38,11 +38,13 @@
<div class="content">
{{ .Content }}
</div>
{{ partial "components/last-updated.html" . }}
{{ .Scratch.Set "reversePagination" true }}
{{ partial "components/pager.html" . }}
{{ partial "components/comments.html" . }}
{{- partial "components/last-updated.html" . -}}
{{- if (site.Params.blog.article.displayPagination | default true) -}}
{{- .Scratch.Set "reversePagination" true -}}
{{- partial "components/pager.html" . -}}
{{ end }}
{{- partial "components/comments.html" . -}}
</main>
</article>
</div>
{{ end }}
{{ end }}

View File

@ -25,5 +25,5 @@
{{- if transform.CanHighlight $lang -}}
<div>{{- highlight $content $lang $options -}}</div>
{{- else -}}
<pre><code>{{ $content }}</code></pre>
<div><pre><code>{{ $content }}</code></pre></div>
{{- end -}}

View File

@ -19,11 +19,11 @@
<nav class="hx-mx-auto hx-flex hx-items-center hx-justify-end hx-gap-2 hx-h-16 hx-px-6 {{ $navWidth }}">
<a class="hx-flex hx-items-center hover:hx-opacity-75 ltr:hx-mr-auto rtl:hx-ml-auto" href="{{ $logoLink }}">
{{- if (.Site.Params.navbar.displayLogo | default true) }}
<img class="hx-block dark:hx-hidden" src="{{ $logoPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
<img class="hx-hidden dark:hx-block" src="{{ $logoDarkPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
<img class="hx-mr-2 hx-block dark:hx-hidden" src="{{ $logoPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
<img class="hx-mr-2 hx-hidden dark:hx-block" src="{{ $logoDarkPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
{{- end }}
{{- if (.Site.Params.navbar.displayTitle | default true) }}
<span class="hx-mx-2 hx-font-extrabold hx-inline hx-select-none" title="{{ .Site.Title }}">{{- .Site.Title -}}</span>
<span class="hx-mr-2 hx-font-extrabold hx-inline hx-select-none" title="{{ .Site.Title }}">{{- .Site.Title -}}</span>
{{- end }}
</a>

View File

@ -1,104 +1,15 @@
{{- $jsTheme := resources.Get "js/theme.js" | resources.ExecuteAsTemplate "theme.js" . -}}
{{- $jsMenu := resources.Get "js/menu.js" -}}
{{- $jsTabs := resources.Get "js/tabs.js" -}}
{{- $jsLang := resources.Get "js/lang.js" -}}
{{- $jsCodeCopy := resources.Get "js/code-copy.js" -}}
{{- $jsFileTree := resources.Get "js/filetree.js" -}}
{{- $jsSidebar := resources.Get "js/sidebar.js" -}}
{{- $jsBackToTop := resources.Get "js/back-to-top.js" -}}
{{- $scripts := slice $jsTheme $jsMenu $jsCodeCopy $jsTabs $jsLang $jsFileTree $jsSidebar $jsBackToTop | resources.Concat "js/main.js" -}}
{{- if hugo.IsProduction -}}
{{- $scripts = $scripts | minify | fingerprint -}}
{{- end -}}
<script defer src="{{ $scripts.RelPermalink }}" integrity="{{ $scripts.Data.Integrity }}"></script>
{{/* Core scripts (theme, menu, tabs, etc.) */}}
{{- partial "scripts/core.html" . -}}
{{/* Search */}}
{{- if (site.Params.search.enable | default true) -}}
{{- $searchType := site.Params.search.type | default "flexsearch" -}}
{{- if eq $searchType "flexsearch" -}}
{{- $jsSearchScript := printf "%s.search.js" .Language.Lang -}}
{{- $jsSearch := resources.Get "js/flexsearch.js" | resources.ExecuteAsTemplate $jsSearchScript . -}}
{{- if hugo.IsProduction -}}
{{- $jsSearch = $jsSearch | minify | fingerprint -}}
{{- end -}}
{{- $flexSearchJS := resources.Get "lib/flexsearch/flexsearch.bundle.min.js" | fingerprint -}}
<script defer src="{{ $flexSearchJS.RelPermalink }}" integrity="{{ $flexSearchJS.Data.Integrity }}"></script>
<script defer src="{{ $jsSearch.RelPermalink }}" integrity="{{ $jsSearch.Data.Integrity }}"></script>
{{- else -}}
{{- warnf `search type "%s" is not supported` $searchType -}}
{{- end -}}
{{- end -}}
{{- partial "scripts/search.html" . -}}
{{/* Mermaid */}}
{{/* FIXME: need to investigate .Page.Store hasMermaid is set for homepage */}}
{{- if and (.Page.Store.Get "hasMermaid") (not .Page.IsHome) -}}
{{- $mermaidJS := resources.Get "lib/mermaid/mermaid.min.js" | fingerprint -}}
<script defer src="{{ $mermaidJS.RelPermalink }}" integrity="{{ $mermaidJS.Data.Integrity }}"></script>
<script>
document.addEventListener("DOMContentLoaded", () => {
// Store original mermaid code for each diagram
document.querySelectorAll(".mermaid").forEach(el => {
el.dataset.original = el.innerHTML;
});
const theme = document.documentElement.classList.contains("dark") ? "dark" : "default";
mermaid.initialize({ startOnLoad: true, theme: theme });
let timeout;
new MutationObserver(() => {
clearTimeout(timeout);
timeout = setTimeout(() => {
const theme = document.documentElement.classList.contains("dark") ? "dark" : "default";
document.querySelectorAll(".mermaid").forEach(el => {
// Reset to original content, preserving HTML
el.innerHTML = el.dataset.original;
el.removeAttribute("data-processed");
});
mermaid.initialize({ startOnLoad: true, theme: theme });
mermaid.init();
}, 150);
}).observe(document.documentElement, {
attributes: true,
attributeFilter: ["class"]
});
});
</script>
{{- if (.Store.Get "hasMermaid") -}}
{{- partial "scripts/mermaid.html" . -}}
{{- end -}}
{{/* KaTex */}}
{{- if .Page.Params.math -}}
{{- $katexCSS := resources.Get "lib/katex/katex.min.css" | fingerprint -}}
{{- $katexJS := resources.Get "lib/katex/katex.min.js" | fingerprint -}}
{{- $mhchemJS := resources.Get "lib/katex/mhchem.min.js" | fingerprint -}}
{{- $katexAutoRenderJS := resources.Get "lib/katex/auto-render.min.js" | fingerprint -}}
<link type="text/css" rel="stylesheet" href="{{ $katexCSS.RelPermalink }}" integrity="{{ $katexCSS.Data.Integrity }}" />
<script defer src="{{ $katexJS.RelPermalink }}" integrity="{{ $katexJS.Data.Integrity }}"></script>
<script defer src="{{ $katexAutoRenderJS.RelPermalink }}" integrity="{{ $katexAutoRenderJS.Data.Integrity }}"></script>
<script defer src="{{ $mhchemJS.RelPermalink }}" integrity="{{ $mhchemJS.Data.Integrity }}"></script>
{{ $katexFonts := resources.Match "lib/katex/fonts/*" }}
{{- range $katexFonts -}}
{{ .Publish }}
{{- end -}}
<script>
// TODO: make render options configurable
// Reference: https://katex.org/docs/autorender#api
document.addEventListener("DOMContentLoaded", function () {
renderMathInElement(document.body, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false },
{ left: "\\begin{equation}", right: "\\end{equation}", display: true },
{left: "\\begin{align}", right: "\\end{align}", display: true},
{left: "\\begin{alignat}", right: "\\end{alignat}", display: true},
{left: "\\begin{gather}", right: "\\end{gather}", display: true},
{left: "\\begin{CD}", right: "\\end{CD}", display: true},
{ left: "\\[", right: "\\]", display: true },
],
throwOnError: false,
});
});
</script>
{{ end }}
{{- partial "scripts/katex.html" . -}}
{{- end -}}

View File

@ -0,0 +1,14 @@
{{- $jsTheme := resources.Get "js/theme.js" | resources.ExecuteAsTemplate "theme.js" . -}}
{{- $jsMenu := resources.Get "js/menu.js" -}}
{{- $jsTabs := resources.Get "js/tabs.js" -}}
{{- $jsLang := resources.Get "js/lang.js" -}}
{{- $jsCodeCopy := resources.Get "js/code-copy.js" -}}
{{- $jsFileTree := resources.Get "js/filetree.js" -}}
{{- $jsSidebar := resources.Get "js/sidebar.js" -}}
{{- $jsBackToTop := resources.Get "js/back-to-top.js" -}}
{{- $scripts := slice $jsTheme $jsMenu $jsCodeCopy $jsTabs $jsLang $jsFileTree $jsSidebar $jsBackToTop | resources.Concat "js/main.js" -}}
{{- if hugo.IsProduction -}}
{{- $scripts = $scripts | minify | fingerprint -}}
{{- end -}}
<script defer src="{{ $scripts.RelPermalink }}" integrity="{{ $scripts.Data.Integrity }}"></script>

View File

@ -0,0 +1,33 @@
{{/* KaTex */}}
{{- $katexCSS := resources.Get "lib/katex/katex.min.css" | fingerprint -}}
{{- $katexJS := resources.Get "lib/katex/katex.min.js" | fingerprint -}}
{{- $mhchemJS := resources.Get "lib/katex/mhchem.min.js" | fingerprint -}}
{{- $katexAutoRenderJS := resources.Get "lib/katex/auto-render.min.js" | fingerprint -}}
<link type="text/css" rel="stylesheet" href="{{ $katexCSS.RelPermalink }}" integrity="{{ $katexCSS.Data.Integrity }}" />
<script defer src="{{ $katexJS.RelPermalink }}" integrity="{{ $katexJS.Data.Integrity }}"></script>
<script defer src="{{ $katexAutoRenderJS.RelPermalink }}" integrity="{{ $katexAutoRenderJS.Data.Integrity }}"></script>
<script defer src="{{ $mhchemJS.RelPermalink }}" integrity="{{ $mhchemJS.Data.Integrity }}"></script>
{{ $katexFonts := resources.Match "lib/katex/fonts/*" }}
{{- range $katexFonts -}}
{{ .Publish }}
{{- end -}}
<script>
// TODO: make render options configurable
// Reference: https://katex.org/docs/autorender#api
document.addEventListener("DOMContentLoaded", function () {
renderMathInElement(document.body, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false },
{ left: "\\begin{equation}", right: "\\end{equation}", display: true },
{left: "\\begin{align}", right: "\\end{align}", display: true},
{left: "\\begin{alignat}", right: "\\end{alignat}", display: true},
{left: "\\begin{gather}", right: "\\end{gather}", display: true},
{left: "\\begin{CD}", right: "\\end{CD}", display: true},
{ left: "\\[", right: "\\]", display: true },
],
throwOnError: false,
});
});
</script>

View File

@ -0,0 +1,33 @@
{{/* Mermaid */}}
{{- $mermaidJS := resources.Get "lib/mermaid/mermaid.min.js" | fingerprint -}}
<script defer src="{{ $mermaidJS.RelPermalink }}" integrity="{{ $mermaidJS.Data.Integrity }}"></script>
<script>
document.addEventListener("DOMContentLoaded", () => {
// Store original mermaid code for each diagram
document.querySelectorAll(".mermaid").forEach(el => {
el.dataset.original = el.innerHTML;
});
const theme = document.documentElement.classList.contains("dark") ? "dark" : "default";
mermaid.initialize({ startOnLoad: true, theme: theme });
let timeout;
new MutationObserver(() => {
clearTimeout(timeout);
timeout = setTimeout(() => {
const theme = document.documentElement.classList.contains("dark") ? "dark" : "default";
document.querySelectorAll(".mermaid").forEach(el => {
// Reset to original content, preserving HTML
el.innerHTML = el.dataset.original;
el.removeAttribute("data-processed");
});
mermaid.initialize({ startOnLoad: true, theme: theme });
mermaid.init();
}, 150);
}).observe(document.documentElement, {
attributes: true,
attributeFilter: ["class"]
});
});
</script>

View File

@ -0,0 +1,16 @@
{{/* Search */}}
{{- if (site.Params.search.enable | default true) -}}
{{- $searchType := site.Params.search.type | default "flexsearch" -}}
{{- if eq $searchType "flexsearch" -}}
{{- $jsSearchScript := printf "%s.search.js" .Language.Lang -}}
{{- $jsSearch := resources.Get "js/flexsearch.js" | resources.ExecuteAsTemplate $jsSearchScript . -}}
{{- if hugo.IsProduction -}}
{{- $jsSearch = $jsSearch | minify | fingerprint -}}
{{- end -}}
{{- $flexSearchJS := resources.Get "lib/flexsearch/flexsearch.bundle.min.js" | fingerprint -}}
<script defer src="{{ $flexSearchJS.RelPermalink }}" integrity="{{ $flexSearchJS.Data.Integrity }}"></script>
<script defer src="{{ $jsSearch.RelPermalink }}" integrity="{{ $jsSearch.Data.Integrity }}"></script>
{{- else -}}
{{- warnf `search type "%s" is not supported` $searchType -}}
{{- end -}}
{{- end -}}

View File

@ -126,7 +126,7 @@
href="#{{ anchorize .ID }}"
class="hx-flex hx-rounded hx-px-2 hx-py-1.5 hx-text-sm hx-transition-colors [word-break:break-word] hx-cursor-pointer [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] contrast-more:hx-border hx-gap-2 before:hx-opacity-25 before:hx-content-['#'] hx-text-gray-500 hover:hx-bg-gray-100 hover:hx-text-gray-900 dark:hx-text-neutral-400 dark:hover:hx-bg-primary-100/5 dark:hover:hx-text-gray-50 contrast-more:hx-text-gray-900 contrast-more:dark:hx-text-gray-50 contrast-more:hx-border-transparent contrast-more:hover:hx-border-gray-900 contrast-more:dark:hover:hx-border-gray-50"
>
{{- .Title -}}
{{- .Title | safeHTML | plainify | htmlUnescape -}}
</a>
</li>
{{ end -}}
@ -144,7 +144,13 @@
<span class="hx-cursor-default">{{ $name }}</span>
</li>
{{ else }}
<li>{{ template "sidebar-item-link" dict "active" false "title" $name "link" (.URL | relLangURL) }}</li>
{{- $link := .URL -}}
{{- with .PageRef -}}
{{- if hasPrefix . "/" -}}
{{- $link = relLangURL (strings.TrimPrefix "/" .) -}}
{{- end -}}
{{- end -}}
<li>{{ template "sidebar-item-link" dict "active" false "title" $name "link" $link }}</li>
{{ end }}
{{- end -}}
{{- end -}}

View File

@ -15,16 +15,21 @@
{{- $options := .Get "options" | default "800x webp q80" -}}
{{- $process := .Get "process" | default (printf "%s %s" $method $options) -}}
{{- with or (.Page.Resources.Get $image) (resources.Get $image) -}}
{{/* Retrieve the $image resource from local or global resources */}}
{{- $processed := .Process $process -}}
{{- $width = $processed.Width -}}
{{- $height = $processed.Height -}}
{{- $image = $processed.RelPermalink -}}
{{ else }}
{{/* Otherwise, use relative link of the image */}}
{{- if hasPrefix $image "/" -}}
{{- $image = relURL (strings.TrimPrefix "/" $image) -}}
{{- if and $image (not (urls.Parse $image).Scheme) -}}
{{- with or (.Page.Resources.Get $image) (resources.Get $image) -}}
{{/* .Process does not work on svgs */}}
{{- if (not (eq .MediaType.SubType "svg")) -}}
{{/* Retrieve the $image resource from local or global resources */}}
{{- $processed := .Process $process -}}
{{- $width = $processed.Width -}}
{{- $height = $processed.Height -}}
{{- $image = $processed.RelPermalink -}}
{{- end -}}
{{ else }}
{{/* Otherwise, use relative link of the image */}}
{{- if hasPrefix $image "/" -}}
{{- $image = relURL (strings.TrimPrefix "/" $image) -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@ -1,5 +1,5 @@
<div class="hextra-filetree hx-mt-6 hx-select-none hx-text-sm hx-text-gray-800 dark:hx-text-gray-300 not-prose">
<div class="hx-inline-block hx-rounded-lg hx-border hx-px-4 hx-py-2 dark:hx-border-neutral-800">
{{- .Inner -}}
{{- .InnerDeindent -}}
</div>
</div>

View File

@ -12,6 +12,6 @@
<span class="ltr:hx-ml-1 rtl:hx-mr-1">{{ $name }}</span>
</button>
<ul data-state="{{ $state }}" class="ltr:hx-pl-5 rtl:hx-pr-5 data-[state=closed]:hx-hidden">
{{- .Inner -}}
{{- .InnerDeindent -}}
</ul>
</li>

View File

@ -7,6 +7,6 @@ command = "cd exampleSite && hugo --gc --minify --themesDir ../.. -b ${DEPLOY_PR
ignore = "false"
[build.environment]
HUGO_VERSION = "0.138.0"
GO_VERSION = "1.22.3"
NODE_VERSION = "22.2.0"
HUGO_VERSION = "0.145.0"
GO_VERSION = "1.24.0"
NODE_VERSION = "22.14.0"

View File

@ -9,7 +9,7 @@ homepage = "https://github.com/imfing/hextra/"
demosite = "https://imfing.github.io/hextra/"
tags = ["Modern", "Elegant", "Blog", "Documentation", "Responsive", "Clean", "Light", "Dark", "Minimal"]
features = ["Responsive", "Dark Mode", "Search", "Syntax Highlighting", "Multilingual", "Social", "Blog", "RSS", "Customization"]
min_version = "0.124.0"
min_version = "0.134.0"
[author]
name = "Xin"