mirror of
https://github.com/imfing/hextra.git
synced 2025-07-01 19:27:15 -04:00
Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
f5e4283961 | |||
10f1d85ab4 | |||
fd9a87a86a | |||
1f9e7c8b39 | |||
7772313a53 | |||
7f0a35ab48 | |||
35c733b7ee | |||
aad68d8afd | |||
d58a8b5469 | |||
64ac97b2d6 | |||
27c976bcc1 | |||
d675d3bc7b | |||
456c96921a | |||
c2d7ba8ce5 | |||
8801a04ebe | |||
21b0acdec5 | |||
c0a1bc32dd | |||
4ea18168e3 | |||
23c84e124c | |||
678f0b86ee | |||
defc9bc11b | |||
363c8c91ee | |||
088e9f7821 |
@ -499,6 +499,9 @@ video {
|
|||||||
.pointer-events-none {
|
.pointer-events-none {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
.fixed {
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
.absolute {
|
.absolute {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
@ -508,6 +511,9 @@ video {
|
|||||||
.sticky {
|
.sticky {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
}
|
}
|
||||||
|
.inset-0 {
|
||||||
|
inset: 0px;
|
||||||
|
}
|
||||||
.inset-x-0 {
|
.inset-x-0 {
|
||||||
left: 0px;
|
left: 0px;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
@ -543,6 +549,9 @@ video {
|
|||||||
.top-full {
|
.top-full {
|
||||||
top: 100%;
|
top: 100%;
|
||||||
}
|
}
|
||||||
|
.z-10 {
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
.z-20 {
|
.z-20 {
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
}
|
}
|
||||||
@ -625,6 +634,9 @@ video {
|
|||||||
.ml-4 {
|
.ml-4 {
|
||||||
margin-left: 1rem;
|
margin-left: 1rem;
|
||||||
}
|
}
|
||||||
|
.mr-1 {
|
||||||
|
margin-right: 0.25rem;
|
||||||
|
}
|
||||||
.mr-2 {
|
.mr-2 {
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
@ -839,6 +851,9 @@ video {
|
|||||||
.flex-col {
|
.flex-col {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
.flex-wrap {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
.items-start {
|
.items-start {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
@ -869,6 +884,17 @@ video {
|
|||||||
.gap-4 {
|
.gap-4 {
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
.gap-x-1 {
|
||||||
|
-moz-column-gap: 0.25rem;
|
||||||
|
column-gap: 0.25rem;
|
||||||
|
}
|
||||||
|
.gap-x-1\.5 {
|
||||||
|
-moz-column-gap: 0.375rem;
|
||||||
|
column-gap: 0.375rem;
|
||||||
|
}
|
||||||
|
.gap-y-2 {
|
||||||
|
row-gap: 0.5rem;
|
||||||
|
}
|
||||||
.overflow-auto {
|
.overflow-auto {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
@ -966,6 +992,9 @@ video {
|
|||||||
--tw-border-opacity: 1;
|
--tw-border-opacity: 1;
|
||||||
border-color: rgb(254 249 195 / var(--tw-border-opacity));
|
border-color: rgb(254 249 195 / var(--tw-border-opacity));
|
||||||
}
|
}
|
||||||
|
.bg-black\/80 {
|
||||||
|
background-color: rgb(0 0 0 / 0.8);
|
||||||
|
}
|
||||||
.bg-black\/\[\.05\] {
|
.bg-black\/\[\.05\] {
|
||||||
background-color: rgb(0 0 0 / .05);
|
background-color: rgb(0 0 0 / .05);
|
||||||
}
|
}
|
||||||
@ -1154,6 +1183,9 @@ video {
|
|||||||
.align-text-bottom {
|
.align-text-bottom {
|
||||||
vertical-align: text-bottom;
|
vertical-align: text-bottom;
|
||||||
}
|
}
|
||||||
|
.align-\[-2\.5px\] {
|
||||||
|
vertical-align: -2.5px;
|
||||||
|
}
|
||||||
.font-mono {
|
.font-mono {
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||||
}
|
}
|
||||||
@ -1396,8 +1428,8 @@ video {
|
|||||||
-webkit-hyphens: auto;
|
-webkit-hyphens: auto;
|
||||||
hyphens: auto;
|
hyphens: auto;
|
||||||
}
|
}
|
||||||
.\[text-underline-position\:from-font\] {
|
.\[transition\:background-color_1\.5s_ease\] {
|
||||||
text-underline-position: from-font;
|
transition: background-color 1.5s ease;
|
||||||
}
|
}
|
||||||
.\[word-break\:break-word\] {
|
.\[word-break\:break-word\] {
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
@ -2501,6 +2533,19 @@ nav .search-wrapper {
|
|||||||
--tw-shadow-color: rgb(115 115 115 / 0.4);
|
--tw-shadow-color: rgb(115 115 115 / 0.4);
|
||||||
--tw-shadow: var(--tw-shadow-colored);
|
--tw-shadow: var(--tw-shadow-colored);
|
||||||
}
|
}
|
||||||
|
@supports (
|
||||||
|
((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px)))
|
||||||
|
) {
|
||||||
|
.code-copy-btn {
|
||||||
|
--tw-bg-opacity: .85;
|
||||||
|
--tw-backdrop-blur: blur(12px);
|
||||||
|
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||||
|
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||||
|
}
|
||||||
|
:is(html[class~="dark"] .code-copy-btn) {
|
||||||
|
--tw-bg-opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
html {
|
html {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
@ -2707,6 +2752,9 @@ body {
|
|||||||
--tw-rotate: 90deg;
|
--tw-rotate: 90deg;
|
||||||
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
||||||
}
|
}
|
||||||
|
.group:hover .group-hover\:underline {
|
||||||
|
text-decoration-line: underline;
|
||||||
|
}
|
||||||
.group\/code:hover .group-hover\/code\:opacity-100 {
|
.group\/code:hover .group-hover\/code\:opacity-100 {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
@ -2977,6 +3025,9 @@ body {
|
|||||||
:is(html[class~="dark"] .dark\:border-yellow-200\/30) {
|
:is(html[class~="dark"] .dark\:border-yellow-200\/30) {
|
||||||
border-color: rgb(254 240 138 / 0.3);
|
border-color: rgb(254 240 138 / 0.3);
|
||||||
}
|
}
|
||||||
|
:is(html[class~="dark"] .dark\:bg-black\/60) {
|
||||||
|
background-color: rgb(0 0 0 / 0.6);
|
||||||
|
}
|
||||||
:is(html[class~="dark"] .dark\:bg-blue-900\/30) {
|
:is(html[class~="dark"] .dark\:bg-blue-900\/30) {
|
||||||
background-color: rgb(30 58 138 / 0.3);
|
background-color: rgb(30 58 138 / 0.3);
|
||||||
}
|
}
|
||||||
|
7
assets/css/components/code-copy.css
Normal file
7
assets/css/components/code-copy.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@supports (
|
||||||
|
(-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
|
||||||
|
) {
|
||||||
|
.code-copy-btn {
|
||||||
|
@apply backdrop-blur-md bg-opacity-[.85] dark:bg-opacity-80;
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,7 @@
|
|||||||
@import "components/sidebar.css";
|
@import "components/sidebar.css";
|
||||||
@import "components/navbar.css";
|
@import "components/navbar.css";
|
||||||
@import "components/scrollbar.css";
|
@import "components/scrollbar.css";
|
||||||
|
@import "components/code-copy.css";
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@apply text-base antialiased;
|
@apply text-base antialiased;
|
||||||
|
@ -33,8 +33,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
// Add click event listener for copy button
|
// Add click event listener for copy button
|
||||||
button.addEventListener('click', function (e) {
|
button.addEventListener('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const targetId = button.getAttribute('data-clipboard-target');
|
// Get the code target
|
||||||
const target = document.querySelector(targetId);
|
const target = button.parentElement.previousElementSibling;
|
||||||
let codeElement;
|
let codeElement;
|
||||||
if (target.tagName === 'CODE') {
|
if (target.tagName === 'CODE') {
|
||||||
codeElement = target;
|
codeElement = target;
|
||||||
@ -44,14 +44,17 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
codeElement = codeElements[codeElements.length - 1];
|
codeElement = codeElements[codeElements.length - 1];
|
||||||
}
|
}
|
||||||
if (codeElement) {
|
if (codeElement) {
|
||||||
|
let code = codeElement.innerText;
|
||||||
// Replace double newlines with single newlines in the innerText
|
// Replace double newlines with single newlines in the innerText
|
||||||
// as each line inside <span> has trailing newline '\n'
|
// as each line inside <span> has trailing newline '\n'
|
||||||
const code = codeElement.innerText.replace(/\n\n/g, '\n');
|
if ("lang" in codeElement.dataset) {
|
||||||
|
code = code.replace(/\n\n/g, '\n');
|
||||||
|
}
|
||||||
navigator.clipboard.writeText(code).then(function () {
|
navigator.clipboard.writeText(code).then(function () {
|
||||||
button.classList.add('copied');
|
button.classList.add('copied');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
button.classList.remove('copied');
|
button.classList.remove('copied');
|
||||||
}, 500);
|
}, 1000);
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
console.error('Failed to copy text: ', err);
|
console.error('Failed to copy text: ', err);
|
||||||
});
|
});
|
||||||
|
@ -1,19 +1,49 @@
|
|||||||
// Hamburger menu for mobile navigation
|
// Hamburger menu for mobile navigation
|
||||||
|
|
||||||
const menu = document.querySelector('.hamburger-menu');
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
const menu = document.querySelector('.hamburger-menu');
|
||||||
menu.addEventListener('click', (e) => {
|
const overlay = document.querySelector('.mobile-menu-overlay');
|
||||||
e.preventDefault();
|
|
||||||
const sidebarContainer = document.querySelector('.sidebar-container');
|
const sidebarContainer = document.querySelector('.sidebar-container');
|
||||||
|
|
||||||
// Toggle the hamburger menu
|
// Initialize the overlay
|
||||||
menu.querySelector('svg').classList.toggle('open');
|
const overlayClasses = ['fixed', 'inset-0', 'z-10', 'bg-black/80', 'dark:bg-black/60'];
|
||||||
|
overlay.classList.add('bg-transparent');
|
||||||
|
overlay.classList.remove("hidden", ...overlayClasses);
|
||||||
|
|
||||||
// When the menu is open, we want to show the navigation sidebar
|
function toggleMenu() {
|
||||||
sidebarContainer.classList.toggle('max-md:[transform:translate3d(0,-100%,0)]');
|
// Toggle the hamburger menu
|
||||||
sidebarContainer.classList.toggle('max-md:[transform:translate3d(0,0,0)]');
|
menu.querySelector('svg').classList.toggle('open');
|
||||||
|
|
||||||
// When the menu is open, we want to prevent the body from scrolling
|
// When the menu is open, we want to show the navigation sidebar
|
||||||
document.body.classList.toggle('overflow-hidden');
|
sidebarContainer.classList.toggle('max-md:[transform:translate3d(0,-100%,0)]');
|
||||||
document.body.classList.toggle('md:overflow-auto');
|
sidebarContainer.classList.toggle('max-md:[transform:translate3d(0,0,0)]');
|
||||||
|
|
||||||
|
// When the menu is open, we want to prevent the body from scrolling
|
||||||
|
document.body.classList.toggle('overflow-hidden');
|
||||||
|
document.body.classList.toggle('md:overflow-auto');
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.addEventListener('click', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
toggleMenu();
|
||||||
|
|
||||||
|
if (overlay.classList.contains('bg-transparent')) {
|
||||||
|
// Show the overlay
|
||||||
|
overlay.classList.add(...overlayClasses);
|
||||||
|
overlay.classList.remove('bg-transparent');
|
||||||
|
} else {
|
||||||
|
// Hide the overlay
|
||||||
|
overlay.classList.remove(...overlayClasses);
|
||||||
|
overlay.classList.add('bg-transparent');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
overlay.addEventListener('click', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
toggleMenu();
|
||||||
|
|
||||||
|
// Hide the overlay
|
||||||
|
overlay.classList.remove(...overlayClasses);
|
||||||
|
overlay.classList.add('bg-transparent');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -9,6 +9,11 @@ github: >
|
|||||||
<path d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z"></path>
|
<path d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z"></path>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
|
codeberg: >
|
||||||
|
<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M11.955.49A12 12 0 0 0 0 12.49a12 12 0 0 0 1.832 6.373L11.838 5.928a.187.14 0 0 1 .324 0l10.006 12.935A12 12 0 0 0 24 12.49a12 12 0 0 0-12-12 12 12 0 0 0-.045 0zm.375 6.467 4.416 16.553a12 12 0 0 0 5.137-4.213z"/>
|
||||||
|
</svg>
|
||||||
|
|
||||||
hextra: <svg viewBox="0 0 180 180" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="m 105.50024,22.224647 c -9.59169,-5.537563 -21.40871,-5.537563 -31.000093,0 L 39.054693,42.689119 C 29.463353,48.226675 23.55484,58.460531 23.55484,69.535642 v 40.928918 c 0,11.07542 5.908513,21.3092 15.499853,26.84652 l 35.445453,20.46446 c 9.591313,5.53732 21.408404,5.53732 31.000094,0 l 35.44507,-20.46446 c 9.59131,-5.53732 15.49985,-15.7711 15.49985,-26.84652 V 69.535642 c 0,-11.075111 -5.90854,-21.308967 -15.49985,-26.846523 z M 34.112797,85.737639 c -1.384445,2.397827 -1.384445,5.352099 0,7.749927 l 24.781554,42.922974 c 1.38437,2.39783 3.942853,3.87496 6.711592,3.87496 h 49.563107 c 2.76905,0 5.3273,-1.47713 6.71144,-3.87496 l 24.78194,-42.922974 c 1.38414,-2.397828 1.38414,-5.3521 0,-7.749927 L 121.88049,42.814746 c -1.38414,-2.397828 -3.94239,-3.874964 -6.71144,-3.874964 H 65.605944 c -2.768739,0 -5.327223,1.477059 -6.711592,3.874964 z" style="stroke-width:0.774993" /></svg>
|
hextra: <svg viewBox="0 0 180 180" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="m 105.50024,22.224647 c -9.59169,-5.537563 -21.40871,-5.537563 -31.000093,0 L 39.054693,42.689119 C 29.463353,48.226675 23.55484,58.460531 23.55484,69.535642 v 40.928918 c 0,11.07542 5.908513,21.3092 15.499853,26.84652 l 35.445453,20.46446 c 9.591313,5.53732 21.408404,5.53732 31.000094,0 l 35.44507,-20.46446 c 9.59131,-5.53732 15.49985,-15.7711 15.49985,-26.84652 V 69.535642 c 0,-11.075111 -5.90854,-21.308967 -15.49985,-26.846523 z M 34.112797,85.737639 c -1.384445,2.397827 -1.384445,5.352099 0,7.749927 l 24.781554,42.922974 c 1.38437,2.39783 3.942853,3.87496 6.711592,3.87496 h 49.563107 c 2.76905,0 5.3273,-1.47713 6.71144,-3.87496 l 24.78194,-42.922974 c 1.38414,-2.397828 1.38414,-5.3521 0,-7.749927 L 121.88049,42.814746 c -1.38414,-2.397828 -3.94239,-3.874964 -6.71144,-3.874964 H 65.605944 c -2.768739,0 -5.327223,1.477059 -6.711592,3.874964 z" style="stroke-width:0.774993" /></svg>
|
||||||
|
|
||||||
hugo: <svg viewBox="0 0 370 391" xmlns="http://www.w3.org/2000/svg"><g clip-rule="evenodd" fill-rule="evenodd"><path d="m207.5 22.4 114.4 66.6c13.5 7.9 21.9 22.4 21.9 38v136.4c0 17.3-9.3 33.3-24.5 41.8l-113.5 63.9a49.06 49.06 0 0 1 -48.5-.2l-104.5-60.1c-16.4-9.5-26.6-27-26.6-45.9v-129.5c0-19.1 9.9-36.8 26.1-46.8l102.8-63.5c16-9.9 36.2-10.1 52.4-.7z" fill="#ff4088" stroke="#c9177e" stroke-width="27" /><path d="m105.6 298.2v-207.2h43.4v75.5h71.9v-75.5h43.5v207.2h-43.5v-90.6h-71.9v90.6z" fill="#fff" /></g></svg>
|
hugo: <svg viewBox="0 0 370 391" xmlns="http://www.w3.org/2000/svg"><g clip-rule="evenodd" fill-rule="evenodd"><path d="m207.5 22.4 114.4 66.6c13.5 7.9 21.9 22.4 21.9 38v136.4c0 17.3-9.3 33.3-24.5 41.8l-113.5 63.9a49.06 49.06 0 0 1 -48.5-.2l-104.5-60.1c-16.4-9.5-26.6-27-26.6-45.9v-129.5c0-19.1 9.9-36.8 26.1-46.8l102.8-63.5c16-9.9 36.2-10.1 52.4-.7z" fill="#ff4088" stroke="#c9177e" stroke-width="27" /><path d="m105.6 298.2v-207.2h43.4v75.5h71.9v-75.5h43.5v207.2h-43.5v-90.6h-71.9v90.6z" fill="#fff" /></g></svg>
|
||||||
|
@ -2,8 +2,12 @@
|
|||||||
title: Markdown Syntax Guide
|
title: Markdown Syntax Guide
|
||||||
date: 2020-01-01
|
date: 2020-01-01
|
||||||
authors:
|
authors:
|
||||||
- name: John Doe
|
- name: imfing
|
||||||
link: https://example.com/johndoe
|
link: https://github.com/imfing
|
||||||
|
image: https://github.com/imfing.png
|
||||||
|
- name: Octocat
|
||||||
|
link: https://github.com/octocat
|
||||||
|
image: https://github.com/octocat.png
|
||||||
tags:
|
tags:
|
||||||
- Markdown
|
- Markdown
|
||||||
- Example
|
- Example
|
||||||
|
39
exampleSite/content/docs/advanced/comments.zh-cn.md
Normal file
39
exampleSite/content/docs/advanced/comments.zh-cn.md
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
title: 评论系统
|
||||||
|
linkTitle: Comments
|
||||||
|
---
|
||||||
|
|
||||||
|
Hextra 支持在你的网站中添加评论系统。
|
||||||
|
目前已经支持 [giscus](https://giscus.app/).
|
||||||
|
|
||||||
|
<!--more-->
|
||||||
|
|
||||||
|
## giscus
|
||||||
|
|
||||||
|
[giscus](https://giscus.app/) 是由 [GitHub Discussions](https://docs.github.com/en/discussions)驱动的评论系统。Giscus 免费并且开源。
|
||||||
|
|
||||||
|
如需启用 Giscus, 你需要在配置文件中添加以下内容:
|
||||||
|
|
||||||
|
```yaml {filename="hugo.yaml"}
|
||||||
|
params:
|
||||||
|
comments:
|
||||||
|
enable: false
|
||||||
|
type: giscus
|
||||||
|
|
||||||
|
giscus:
|
||||||
|
repo: <repository>
|
||||||
|
repoId: <repository ID>
|
||||||
|
category: <category>
|
||||||
|
categoryId: <category ID>
|
||||||
|
```
|
||||||
|
|
||||||
|
Giscus 配置可以参考 [giscus.app](https://giscus.app/),还可以在那里找到更多详细信息。
|
||||||
|
|
||||||
|
可以在 front matter 中启用或禁用特定页面的评论:
|
||||||
|
|
||||||
|
```yaml {filename="content/docs/about.md"}
|
||||||
|
---
|
||||||
|
title: About
|
||||||
|
comments: true
|
||||||
|
---
|
||||||
|
```
|
@ -47,8 +47,8 @@ The primary color of the theme can be customized by setting the `--primary-hue`
|
|||||||
|
|
||||||
List of available syntax highlighting themes are available at [Chroma Styles Gallery](https://xyproto.github.io/splash/docs/all.html). The stylesheet can be generated using the command:
|
List of available syntax highlighting themes are available at [Chroma Styles Gallery](https://xyproto.github.io/splash/docs/all.html). The stylesheet can be generated using the command:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
$ hugo gen chromastyles --style=github
|
hugo gen chromastyles --style=github
|
||||||
```
|
```
|
||||||
|
|
||||||
To override the default syntax highlighting theme, we can add the generated styles to the custom CSS file.
|
To override the default syntax highlighting theme, we can add the generated styles to the custom CSS file.
|
||||||
@ -70,4 +70,4 @@ For further information, refer to the [Hugo Templates](https://gohugo.io/templat
|
|||||||
|
|
||||||
## Further Customization
|
## Further Customization
|
||||||
|
|
||||||
Didn't find what you were looking for? Feel free to [open an issue](https://github.com/imfing/hextra/issues) or make a contribution to the theme!
|
Didn't find what you were looking for? Feel free to [open a discussion](https://github.com/imfing/hextra/discussions) or make a contribution to the theme!
|
||||||
|
@ -30,10 +30,10 @@ Hextra 在 `hugo.yaml` 中提供了一些自定义选项来配置主题。
|
|||||||
|
|
||||||
### 代码高亮
|
### 代码高亮
|
||||||
|
|
||||||
代码高亮风格的详细信息可在 [Chroma Styles Gallery](https://xyproto.github.io/splash/docs/all.html) 中找到。 可以使用以下命令生成样式表:
|
代码高亮风格的详细信息可在 [Chroma Styles Gallery](https://xyproto.github.io/splash/docs/all.html) 中找到。可以使用以下命令生成样式表:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
$ hugo gen chromastyles --style=github
|
hugo gen chromastyles --style=github
|
||||||
```
|
```
|
||||||
|
|
||||||
可将生成的样式添加到自定义 CSS 文件中以覆盖默认代码高亮样式。
|
可将生成的样式添加到自定义 CSS 文件中以覆盖默认代码高亮样式。
|
||||||
@ -55,4 +55,4 @@ layouts/partials/custom/head-end.html
|
|||||||
|
|
||||||
## 进一步定制 Hextra
|
## 进一步定制 Hextra
|
||||||
|
|
||||||
没有找到你想修改的东西?在 GitHub 上[创建 Issues](https://github.com/imfing/hextra/issues) 或为 Hextra 贡献你的智慧!
|
没有找到你想修改的内容?在 GitHub 上[创建 Discussion](https://github.com/imfing/hextra/discussions) 或为 Hextra 贡献你的智慧!
|
||||||
|
@ -43,18 +43,18 @@ Before starting, you need to have the following software installed:
|
|||||||
### Initialize a new Hugo site
|
### Initialize a new Hugo site
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo new site my-site --format=yaml
|
hugo new site my-site --format=yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configure Hextra theme via module
|
### Configure Hextra theme via module
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# initialize hugo module
|
# initialize hugo module
|
||||||
$ cd my-site
|
cd my-site
|
||||||
$ hugo mod init github.com/username/my-site
|
hugo mod init github.com/username/my-site
|
||||||
|
|
||||||
# add Hextra theme
|
# add Hextra theme
|
||||||
$ hugo mod get github.com/imfing/hextra
|
hugo mod get github.com/imfing/hextra
|
||||||
```
|
```
|
||||||
|
|
||||||
Configure `hugo.yaml` to use Hextra theme by adding the following:
|
Configure `hugo.yaml` to use Hextra theme by adding the following:
|
||||||
@ -70,14 +70,14 @@ module:
|
|||||||
Create new content page for the home page and the documentation page:
|
Create new content page for the home page and the documentation page:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo new content/_index.md
|
hugo new content/_index.md
|
||||||
$ hugo new content/docs/_index.md
|
hugo new content/docs/_index.md
|
||||||
```
|
```
|
||||||
|
|
||||||
### Preview the site locally
|
### Preview the site locally
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo server --buildDrafts --disableFastRender
|
hugo server --buildDrafts --disableFastRender
|
||||||
```
|
```
|
||||||
|
|
||||||
Voila, your new site preview is available at `http://localhost:1313/`.
|
Voila, your new site preview is available at `http://localhost:1313/`.
|
||||||
@ -90,7 +90,7 @@ Voila, your new site preview is available at `http://localhost:1313/`.
|
|||||||
To update all Hugo modules in your project to their latest versions, run the following command:
|
To update all Hugo modules in your project to their latest versions, run the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo mod get -u
|
hugo mod get -u
|
||||||
```
|
```
|
||||||
|
|
||||||
To update Hextra to the [latest released version](https://github.com/imfing/hextra/releases), run the following command:
|
To update Hextra to the [latest released version](https://github.com/imfing/hextra/releases), run the following command:
|
||||||
@ -119,7 +119,7 @@ Before starting, you need to have the following software installed:
|
|||||||
### Initialize a new Hugo site
|
### Initialize a new Hugo site
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo new site my-site --format=yaml
|
hugo new site my-site --format=yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### Add Hextra theme as a Git submodule
|
### Add Hextra theme as a Git submodule
|
||||||
@ -139,14 +139,14 @@ theme: hextra
|
|||||||
Create new content page for the home page and the documentation page:
|
Create new content page for the home page and the documentation page:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo new content/_index.md
|
hugo new content/_index.md
|
||||||
$ hugo new content/docs/_index.md
|
hugo new content/docs/_index.md
|
||||||
```
|
```
|
||||||
|
|
||||||
### Preview the site locally
|
### Preview the site locally
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo server --buildDrafts --disableFastRender
|
hugo server --buildDrafts --disableFastRender
|
||||||
```
|
```
|
||||||
|
|
||||||
Your new site preview is available at `http://localhost:1313/`.
|
Your new site preview is available at `http://localhost:1313/`.
|
||||||
@ -168,7 +168,7 @@ Failure to run this command results in the theme folder not being populated with
|
|||||||
To update all submodules in your repository to their latest commits, run the following command:
|
To update all submodules in your repository to their latest commits, run the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ git submodule update --remote
|
git submodule update --remote
|
||||||
```
|
```
|
||||||
|
|
||||||
To update Hextra to the latest commit, run the following command:
|
To update Hextra to the latest commit, run the following command:
|
||||||
|
@ -26,23 +26,21 @@ prev: /docs
|
|||||||
|
|
||||||
[Hugo 模块](https://gohugo.io/hugo-modules/)是管理 Hugo 主题的推荐方式。要使用 Hugo 模块,我们需要安装 [Git](https://git-scm.com/) 和 [Go](https://go.dev/)。
|
[Hugo 模块](https://gohugo.io/hugo-modules/)是管理 Hugo 主题的推荐方式。要使用 Hugo 模块,我们需要安装 [Git](https://git-scm.com/) 和 [Go](https://go.dev/)。
|
||||||
|
|
||||||
{{% steps %}}
|
|
||||||
|
|
||||||
### 初始化 Hugo 站点
|
### 初始化 Hugo 站点
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
$ hugo new site my-site --format=yaml
|
hugo new site my-site --format=yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### 通过模块配置 Hextra 主题
|
### 通过 Hugo Module 安装
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# 初始化 Hugo 模块
|
# 初始化 Hugo 模块
|
||||||
$ cd my-site
|
cd my-site
|
||||||
$ hugo mod init github.com/username/my-site
|
hugo mod init github.com/username/my-site
|
||||||
|
|
||||||
# 添加 Hextra
|
# 添加 Hextra
|
||||||
$ hugo mod get github.com/imfing/hextra
|
hugo mod get github.com/imfing/hextra
|
||||||
```
|
```
|
||||||
|
|
||||||
编辑 `hugo.yaml` 以启用 Hextra:
|
编辑 `hugo.yaml` 以启用 Hextra:
|
||||||
@ -53,31 +51,92 @@ module:
|
|||||||
- path: github.com/imfing/hextra
|
- path: github.com/imfing/hextra
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 通过 Git Submodule 安装
|
||||||
|
|
||||||
|
#### 先决条件
|
||||||
|
|
||||||
|
在我们开始之前,你必须先确保以下软件已经安装:
|
||||||
|
|
||||||
|
- [Hugo (extended version)](https://gohugo.io/installation/)
|
||||||
|
- [Git](https://git-scm.com/)
|
||||||
|
|
||||||
|
#### 步骤
|
||||||
|
|
||||||
|
{{% steps %}}
|
||||||
|
|
||||||
|
### 初始化 Hugo 站点
|
||||||
|
|
||||||
|
```shell
|
||||||
|
hugo new site my-site --format=yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
### 将 Hextra 添加为 Git Submodule
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git submodule add https://github.com/imfing/hextra.git themes/hextra
|
||||||
|
```
|
||||||
|
|
||||||
|
添加以下内容来配置 `hugo.yaml` 以使用 Hextra:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
theme: hextra
|
||||||
|
```
|
||||||
|
|
||||||
### 创建你的第一个内容页
|
### 创建你的第一个内容页
|
||||||
|
|
||||||
让我们为主页和文档页面创建一个新的内容页面:
|
让我们为主页和文档页面创建一个新的内容页面:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo new content/_index.md
|
hugo new content/_index.md
|
||||||
$ hugo new content/docs/_index.md
|
hugo new content/docs/_index.md
|
||||||
```
|
```
|
||||||
|
|
||||||
### 在本地预览站点
|
### 在本地预览站点
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo server --buildDrafts --disableFastRender
|
hugo server --buildDrafts --disableFastRender
|
||||||
```
|
```
|
||||||
|
|
||||||
瞧!你现在可以在 `http://localhost:1313/` 看到你的新站点。
|
瞧!你现在可以在 `http://localhost:1313/` 看到你的新站点。
|
||||||
|
|
||||||
{{% /steps %}}
|
{{% /steps %}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
使用 [CI/CD](https://en.wikipedia.org/wiki/CI/CD) 进行部署时,必须确保在运行 `hugo` 命令之前执行以下命令。
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git submodule update --init
|
||||||
|
```
|
||||||
|
|
||||||
|
如果不运行此命令,theme 中将不会存在 Hextra 文件,进而导致构建失败。
|
||||||
|
|
||||||
|
|
||||||
|
{{% details title="如何更新主题?" %}}
|
||||||
|
|
||||||
|
如需把项目中所有的 Hugo Modules 都升级到最新,在终端中运行此命令:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
hugo mod get -u
|
||||||
|
```
|
||||||
|
|
||||||
|
如需把 Hextra 升级到[最新的发行版本](https://github.com/imfing/hextra/releases), 在终端中运行此命令:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
hugo mod get -u github.com/imfing/hextra
|
||||||
|
```
|
||||||
|
|
||||||
|
如果你需要获得更多信息,参见 [Hugo Modules](https://gohugo.io/hugo-modules/use-modules/#update-all-modules).
|
||||||
|
|
||||||
|
{{% /details %}}
|
||||||
|
|
||||||
## 接下来
|
## 接下来
|
||||||
|
|
||||||
你可以探索以下部分来添加更多内容:
|
探索这些文档以便添加更多内容:
|
||||||
|
|
||||||
{{< cards >}}
|
{{< cards >}}
|
||||||
{{< card link="../guide/organize-files" title="目录结构" icon="document-duplicate" >}}
|
{{< card link="../guide/organize-files" title="Organize Files" icon="document-duplicate" >}}
|
||||||
{{< card link="../guide/configuration" title="配置文件指南" icon="adjustments" >}}
|
{{< card link="../guide/configuration" title="Configuration" icon="adjustments" >}}
|
||||||
{{< card link="../guide/markdown" title="Markdown" icon="markdown" >}}
|
{{< card link="../guide/markdown" title="Markdown" icon="markdown" >}}
|
||||||
{{< /cards >}}
|
{{< /cards >}}
|
||||||
|
@ -90,6 +90,16 @@ params:
|
|||||||
For the main sidebar, it is automatically generated from the structure of the content directory.
|
For the main sidebar, it is automatically generated from the structure of the content directory.
|
||||||
See the [Organize Files](/docs/guide/organize-files) page for more details.
|
See the [Organize Files](/docs/guide/organize-files) page for more details.
|
||||||
|
|
||||||
|
To exclude a single page from the left sidebar, set the `sidebar.exclude` parameter in the front matter of the page:
|
||||||
|
|
||||||
|
```yaml {filename="content/docs/guide/configuration.md"}
|
||||||
|
---
|
||||||
|
title: Configuration
|
||||||
|
sidebar:
|
||||||
|
exclude: true
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
### Extra Links
|
### Extra Links
|
||||||
|
|
||||||
Sidebar extra links are defined under the `menu.sidebar` section in the config file:
|
Sidebar extra links are defined under the `menu.sidebar` section in the config file:
|
||||||
@ -129,17 +139,17 @@ To configure the page edit link, we can set the `params.editURL.base` parameter
|
|||||||
```yaml {filename="hugo.yaml"}
|
```yaml {filename="hugo.yaml"}
|
||||||
params:
|
params:
|
||||||
editURL:
|
editURL:
|
||||||
|
enable: true
|
||||||
base: "https://github.com/your-username/your-repo/edit/main"
|
base: "https://github.com/your-username/your-repo/edit/main"
|
||||||
```
|
```
|
||||||
|
|
||||||
The edit links will be automatically generated for each page based on the provided url as root directory.
|
The edit links will be automatically generated for each page based on the provided url as root directory.
|
||||||
If you want to set edit link for a specific page, you can set the `params.editURL` parameter in the front matter of the page:
|
If you want to set edit link for a specific page, you can set the `editURL` parameter in the front matter of the page:
|
||||||
|
|
||||||
```yaml {filename="content/docs/guide/configuration.md"}
|
```yaml {filename="content/docs/guide/configuration.md"}
|
||||||
---
|
---
|
||||||
title: Configuration
|
title: Configuration
|
||||||
params:
|
editURL: "https://example.com/edit/this/page"
|
||||||
editURL: "https://example.com/edit/this/page"
|
|
||||||
---
|
---
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ menu:
|
|||||||
icon: github
|
icon: github
|
||||||
```
|
```
|
||||||
|
|
||||||
有几种不同类型的菜单项:
|
有几种不同类型的菜单项:
|
||||||
|
|
||||||
1. Link to a page in the site with `pageRef`
|
1. Link to a page in the site with `pageRef`
|
||||||
```yaml
|
```yaml
|
||||||
@ -114,12 +114,126 @@ params:
|
|||||||
```
|
```
|
||||||
|
|
||||||
将为每个页面自动生成编辑链接。
|
将为每个页面自动生成编辑链接。
|
||||||
如需为特定页面设置编辑链接,可以在页面的 `front matter` 中设置 `params.editURL`:
|
如需为特定页面设置编辑链接,可以在页面的 `front matter` 中设置 `editURL`:
|
||||||
|
|
||||||
```yaml {filename="content/docs/guide/configuration.md"}
|
```yaml {filename="content/docs/guide/configuration.md"}
|
||||||
---
|
---
|
||||||
title: Configuration
|
title: Configuration
|
||||||
params:
|
editURL: "https://example.com/edit/this/page"
|
||||||
editURL: "https://example.com/edit/this/page"
|
|
||||||
---
|
---
|
||||||
```
|
```
|
||||||
|
## Footer
|
||||||
|
|
||||||
|
### 版权声明
|
||||||
|
|
||||||
|
如需修改网站页脚中显示的版权文本,您需要创建一个名为“i18n/en.yaml”的文件。
|
||||||
|
在此文件中,填写新的版权文本,像这样:
|
||||||
|
|
||||||
|
```yaml {filename="i18n/en.yaml"}
|
||||||
|
copyright: "© 2023 YOUR TEXT HERE"
|
||||||
|
```
|
||||||
|
你可以在 GitHub 存储库中找到示例 [`i18n/en.yaml`](https://github.com/imfing/hextra/blob/main/i18n/en.yaml) 文件。另外,你可以在版权文本中使用 Markdown 格式。
|
||||||
|
|
||||||
|
## 其他
|
||||||
|
|
||||||
|
### Favicon
|
||||||
|
|
||||||
|
如需自定义 [favicon](https://en.wikipedia.org/wiki/Favicon),请将图标文件放在 `static` 文件夹下以覆盖 [主题中的默认 favicon](https://github.com/imfing/hextra/tree/main/static):
|
||||||
|
|
||||||
|
{{< filetree/container >}}
|
||||||
|
{{< filetree/folder name="static" >}}
|
||||||
|
{{< filetree/file name="android-chrome-192x192.png" >}}
|
||||||
|
{{< filetree/file name="android-chrome-512x512.png" >}}
|
||||||
|
{{< filetree/file name="apple-touch-icon.png" >}}
|
||||||
|
{{< filetree/file name="favicon-16x16.png" >}}
|
||||||
|
{{< filetree/file name="favicon-32x32.png" >}}
|
||||||
|
{{< filetree/file name="favicon-dark.svg" >}}
|
||||||
|
{{< filetree/file name="favicon.ico" >}}
|
||||||
|
{{< filetree/file name="favicon.svg" >}}
|
||||||
|
{{< filetree/file name="site.webmanifest" >}}
|
||||||
|
{{< /filetree/folder >}}
|
||||||
|
{{< /filetree/container >}}
|
||||||
|
|
||||||
|
在您的项目中包含 `favicon.ico` 和 `favicon.svg` 文件,以确保网站的网站图标正确显示。
|
||||||
|
|
||||||
|
虽然 `favicon.ico` 通常适用于较旧的浏览器,但 `favicon.svg` 受到现代浏览器的支持,所以更现代的做法是添加 `favicon-dark.svg` 以便在黑暗模式下提供较好的体验体验。
|
||||||
|
|
||||||
|
请随意使用 [favicon.io](https://favicon.io/) 或 [favycon](https://github.com/ruisaraiva19/favycon) 等工具来生成这些图标。
|
||||||
|
|
||||||
|
### 颜色主题配置
|
||||||
|
|
||||||
|
使用`theme`设置来配置默认主题模式和切换按钮,允许访问者在浅色或深色模式之间切换。
|
||||||
|
|
||||||
|
```yaml {filename="hugo.yaml"}
|
||||||
|
params:
|
||||||
|
theme:
|
||||||
|
# light | dark | system
|
||||||
|
default: system
|
||||||
|
displayToggle: true
|
||||||
|
```
|
||||||
|
|
||||||
|
`theme.default` 的可选项:
|
||||||
|
|
||||||
|
- `light` - 仅使用浅色模式
|
||||||
|
- `dark` - 仅使用神色模式
|
||||||
|
- `system` - 跟随系统
|
||||||
|
|
||||||
|
`theme.displayToggle` 控制显示用于更改主题的切换按钮。
|
||||||
|
当设置为“true”时,访问者可以在浅色或深色模式之间切换,覆盖默认设置。
|
||||||
|
|
||||||
|
### 页宽
|
||||||
|
|
||||||
|
页面的宽度可以通过配置文件中的`params.page.width`参数来调整:
|
||||||
|
|
||||||
|
```yaml {filename="hugo.yaml"}
|
||||||
|
params:
|
||||||
|
page:
|
||||||
|
# full (100%), wide (90rem), normal (1280px)
|
||||||
|
width: wide
|
||||||
|
```
|
||||||
|
|
||||||
|
有三个可选项:`full`, `wide`, and `normal`. 默认的页宽模式是 `normal`.
|
||||||
|
|
||||||
|
同样的,导航栏和 `footer` 的宽度也可通过 `params.navbar.width` 和 `params.footer.width` 调整。
|
||||||
|
|
||||||
|
### 搜索
|
||||||
|
|
||||||
|
默认情况下启用由 [FlexSearch](https://github.com/nextapps-de/flexsearch) 提供全文搜索。
|
||||||
|
要自定义搜索索引,请在配置文件中设置 `params.search.flexsearch.index` :
|
||||||
|
|
||||||
|
```yaml {filename="hugo.yaml"}
|
||||||
|
params:
|
||||||
|
# Search
|
||||||
|
search:
|
||||||
|
enable: true
|
||||||
|
type: flexsearch
|
||||||
|
|
||||||
|
flexsearch:
|
||||||
|
# index page by: content | summary | heading | title
|
||||||
|
index: content
|
||||||
|
```
|
||||||
|
`flexsearch.index` 的可选项:
|
||||||
|
|
||||||
|
- `content` - 全内容搜索
|
||||||
|
- `summary` - 概述 [Hugo Content Summaries](https://gohugo.io/content-management/summaries/)
|
||||||
|
- `heading` - 一级和二级标题
|
||||||
|
- `title` - 仅搜索标题
|
||||||
|
|
||||||
|
要从搜索索引中排除页面,更改 front matter 中的 `excludeSearch: true`:
|
||||||
|
|
||||||
|
```yaml {filename="content/docs/guide/configuration.md"}
|
||||||
|
---
|
||||||
|
title: Configuration
|
||||||
|
excludeSearch: true
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
### Google Analytics
|
||||||
|
|
||||||
|
要启用 [Google Analytics](https://marketingplatform.google.com/about/analytics/),设置 `services.googleAnalytics.ID`:
|
||||||
|
|
||||||
|
```yaml {filename="hugo.yaml"}
|
||||||
|
services:
|
||||||
|
googleAnalytics:
|
||||||
|
ID: G-MEASUREMENT_ID
|
||||||
|
```
|
||||||
|
@ -24,7 +24,7 @@ This will be hidden by default.
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
````
|
````markdown
|
||||||
{{%/* details title="Details" */%}}
|
{{%/* details title="Details" */%}}
|
||||||
|
|
||||||
This is the content of the details.
|
This is the content of the details.
|
||||||
@ -34,7 +34,7 @@ Markdown is **supported**.
|
|||||||
{{%/* /details */%}}
|
{{%/* /details */%}}
|
||||||
````
|
````
|
||||||
|
|
||||||
````
|
````markdown
|
||||||
{{%/* details title="Click me to reveal" closed="true" */%}}
|
{{%/* details title="Click me to reveal" closed="true" */%}}
|
||||||
|
|
||||||
This will be hidden by default.
|
This will be hidden by default.
|
||||||
|
@ -12,7 +12,8 @@ Open source projects powered by Hextra.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
{{< cards >}}
|
{{< cards >}}
|
||||||
|
{{< card link="https://developers.osuny.org" title="Osuny" image="https://raw.githubusercontent.com/noesya/osuny-developers/main/static/images/showcase-hextra/screenshot.png" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
{{< card link="https://getporter.org/" title="Porter" image="https://repository-images.githubusercontent.com/155893691/aa249c80-fcf3-11ea-93b0-30079e8d7de4" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
{{< card link="https://getporter.org/" title="Porter" image="https://repository-images.githubusercontent.com/155893691/aa249c80-fcf3-11ea-93b0-30079e8d7de4" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
{{< card link="https://lutheranconfessions.org/" title="LutheranConfessions" image="https://github.com/imfing/hextra/assets/5097752/ad6625e4-88cd-4cad-b102-5399997d0359" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
{{< card link="https://lutheranconfessions.org/" title="LutheranConfessions" image="https://github.com/imfing/hextra/assets/5097752/ad6625e4-88cd-4cad-b102-5399997d0359" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
{{< card link="/" title="Hextra Starter Template" image="https://user-images.githubusercontent.com/5097752/263551418-c403b9a9-a76c-47a6-8466-513d772ef0b7.jpg" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
{{< card link="https://github.com/imfing/hextra-starter-template/" title="Hextra Starter Template" image="https://user-images.githubusercontent.com/5097752/263551418-c403b9a9-a76c-47a6-8466-513d772ef0b7.jpg" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
{{< /cards >}}
|
{{< /cards >}}
|
||||||
|
@ -12,6 +12,7 @@ layout: wide
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
{{< cards >}}
|
{{< cards >}}
|
||||||
|
{{< card link="https://developers.osuny.org" title="Osuny" image="https://raw.githubusercontent.com/noesya/osuny-developers/main/static/images/showcase-hextra/screenshot.png" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
{{< card link="https://getporter.org/" title="Porter" image="https://repository-images.githubusercontent.com/155893691/aa249c80-fcf3-11ea-93b0-30079e8d7de4" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
{{< card link="https://getporter.org/" title="Porter" image="https://repository-images.githubusercontent.com/155893691/aa249c80-fcf3-11ea-93b0-30079e8d7de4" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
{{< card link="https://lutheranconfessions.org/" title="LutheranConfessions" image="https://github.com/imfing/hextra/assets/5097752/ad6625e4-88cd-4cad-b102-5399997d0359" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
{{< card link="https://lutheranconfessions.org/" title="LutheranConfessions" image="https://github.com/imfing/hextra/assets/5097752/ad6625e4-88cd-4cad-b102-5399997d0359" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
{{< card link="https://github.com/imfing/hextra-starter-template" title="Hextra Starter Template" image="https://user-images.githubusercontent.com/5097752/263551418-c403b9a9-a76c-47a6-8466-513d772ef0b7.jpg" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
{{< card link="https://github.com/imfing/hextra-starter-template" title="Hextra Starter Template" image="https://user-images.githubusercontent.com/5097752/263551418-c403b9a9-a76c-47a6-8466-513d772ef0b7.jpg" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
|
@ -66,13 +66,14 @@
|
|||||||
"[-webkit-touch-callout:none]",
|
"[-webkit-touch-callout:none]",
|
||||||
"[counter-reset:step]",
|
"[counter-reset:step]",
|
||||||
"[hyphens:auto]",
|
"[hyphens:auto]",
|
||||||
"[text-underline-position:from-font]",
|
"[transition:background-color_1.5s_ease]",
|
||||||
"[word-break:break-word]",
|
"[word-break:break-word]",
|
||||||
"absolute",
|
"absolute",
|
||||||
"active:bg-gray-400/20",
|
"active:bg-gray-400/20",
|
||||||
"active:opacity-50",
|
"active:opacity-50",
|
||||||
"active:shadow-gray-200",
|
"active:shadow-gray-200",
|
||||||
"active:shadow-sm",
|
"active:shadow-sm",
|
||||||
|
"align-[-2.5px]",
|
||||||
"align-text-bottom",
|
"align-text-bottom",
|
||||||
"appearance-none",
|
"appearance-none",
|
||||||
"aspect-auto",
|
"aspect-auto",
|
||||||
@ -90,6 +91,7 @@
|
|||||||
"before:pointer-events-none",
|
"before:pointer-events-none",
|
||||||
"before:transition-transform",
|
"before:transition-transform",
|
||||||
"before:w-px",
|
"before:w-px",
|
||||||
|
"bg-black/80",
|
||||||
"bg-black/[.05]",
|
"bg-black/[.05]",
|
||||||
"bg-blue-100",
|
"bg-blue-100",
|
||||||
"bg-clip-text",
|
"bg-clip-text",
|
||||||
@ -159,6 +161,7 @@
|
|||||||
"cursor-pointer",
|
"cursor-pointer",
|
||||||
"dark:before:bg-neutral-800",
|
"dark:before:bg-neutral-800",
|
||||||
"dark:before:invert",
|
"dark:before:invert",
|
||||||
|
"dark:bg-black/60",
|
||||||
"dark:bg-blue-900/30",
|
"dark:bg-blue-900/30",
|
||||||
"dark:bg-dark",
|
"dark:bg-dark",
|
||||||
"dark:bg-dark/50",
|
"dark:bg-dark/50",
|
||||||
@ -235,8 +238,10 @@
|
|||||||
"ease-in",
|
"ease-in",
|
||||||
"filename",
|
"filename",
|
||||||
"first:mt-0",
|
"first:mt-0",
|
||||||
|
"fixed",
|
||||||
"flex",
|
"flex",
|
||||||
"flex-col",
|
"flex-col",
|
||||||
|
"flex-wrap",
|
||||||
"focus:bg-white",
|
"focus:bg-white",
|
||||||
"focus:outline-none",
|
"focus:outline-none",
|
||||||
"focus:ring-4",
|
"focus:ring-4",
|
||||||
@ -254,6 +259,8 @@
|
|||||||
"gap-1",
|
"gap-1",
|
||||||
"gap-2",
|
"gap-2",
|
||||||
"gap-4",
|
"gap-4",
|
||||||
|
"gap-x-1.5",
|
||||||
|
"gap-y-2",
|
||||||
"grid",
|
"grid",
|
||||||
"grid-cols-1",
|
"grid-cols-1",
|
||||||
"group",
|
"group",
|
||||||
@ -262,6 +269,7 @@
|
|||||||
"group-data-[theme=dark]:hidden",
|
"group-data-[theme=dark]:hidden",
|
||||||
"group-data-[theme=light]:hidden",
|
"group-data-[theme=light]:hidden",
|
||||||
"group-hover/code:opacity-100",
|
"group-hover/code:opacity-100",
|
||||||
|
"group-hover:underline",
|
||||||
"group-open:before:rotate-90",
|
"group-open:before:rotate-90",
|
||||||
"group/code",
|
"group/code",
|
||||||
"group/copybtn",
|
"group/copybtn",
|
||||||
@ -311,6 +319,7 @@
|
|||||||
"inline",
|
"inline",
|
||||||
"inline-block",
|
"inline-block",
|
||||||
"inline-flex",
|
"inline-flex",
|
||||||
|
"inset-0",
|
||||||
"inset-x-0",
|
"inset-x-0",
|
||||||
"inset-y-0",
|
"inset-y-0",
|
||||||
"items-center",
|
"items-center",
|
||||||
@ -401,6 +410,8 @@
|
|||||||
"min-w-full",
|
"min-w-full",
|
||||||
"ml-1",
|
"ml-1",
|
||||||
"ml-4",
|
"ml-4",
|
||||||
|
"mobile-menu-overlay",
|
||||||
|
"mr-1",
|
||||||
"mr-2",
|
"mr-2",
|
||||||
"mt-1",
|
"mt-1",
|
||||||
"mt-1.5",
|
"mt-1.5",
|
||||||
@ -585,6 +596,7 @@
|
|||||||
"w-screen",
|
"w-screen",
|
||||||
"whitespace-nowrap",
|
"whitespace-nowrap",
|
||||||
"xl:block",
|
"xl:block",
|
||||||
|
"z-10",
|
||||||
"z-20",
|
"z-20",
|
||||||
"z-[-1]"
|
"z-[-1]"
|
||||||
],
|
],
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
backToTop: "Scroll to top"
|
backToTop: "Scroll to top"
|
||||||
changeLanguage: "Change language"
|
changeLanguage: "Change language"
|
||||||
changeTheme: "Change theme"
|
changeTheme: "Change theme"
|
||||||
|
copyCode: "Copy code"
|
||||||
copyright: "© 2023 Hextra Project."
|
copyright: "© 2023 Hextra Project."
|
||||||
dark: "Dark"
|
dark: "Dark"
|
||||||
editThisPage: "Edit this page on GitHub →"
|
editThisPage: "Edit this page on GitHub →"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{{- $class := .Attributes.class | default "" -}}
|
{{- $class := .Attributes.class | default "" -}}
|
||||||
{{- $filename := .Attributes.filename | default "" -}}
|
{{- $filename := .Attributes.filename | default "" -}}
|
||||||
{{- $lang := .Attributes.lang | default .Type -}}
|
{{- $lang := .Attributes.lang | default .Type -}}
|
||||||
|
{{- $copyCode := (T "copyCode") | default "Copy code" -}}
|
||||||
|
|
||||||
|
|
||||||
<div class="code-block relative mt-6 first:mt-0 group/code">
|
<div class="code-block relative mt-6 first:mt-0 group/code">
|
||||||
@ -8,17 +9,14 @@
|
|||||||
<div class="filename">{{ $filename }}</div>
|
<div class="filename">{{ $filename }}</div>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if transform.CanHighlight $lang -}}
|
{{- if transform.CanHighlight $lang -}}
|
||||||
<div id="code-block-{{ .Ordinal }}">
|
<div>{{- highlight .Inner $lang .Options -}}</div>
|
||||||
{{- highlight .Inner $lang .Options -}}
|
|
||||||
</div>
|
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
<pre><code id="code-block-{{ .Ordinal }}">{{ .Inner }}</code></pre>
|
<pre><code>{{ .Inner }}</code></pre>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
<div class="opacity-0 transition group-hover/code:opacity-100 flex gap-1 absolute m-[11px] right-0 {{ if $filename }}top-8{{ else }}top-0{{ end }}">
|
<div class="opacity-0 transition group-hover/code:opacity-100 flex gap-1 absolute m-[11px] right-0 {{ if $filename }}top-8{{ else }}top-0{{ end }}">
|
||||||
<button
|
<button
|
||||||
class="code-copy-btn group/copybtn transition-all active:opacity-50 bg-primary-700/5 border border-black/5 text-gray-600 hover:text-gray-900 rounded-md p-1.5 dark:bg-primary-300/10 dark:border-white/10 dark:text-gray-400 dark:hover:text-gray-50"
|
class="code-copy-btn group/copybtn transition-all active:opacity-50 bg-primary-700/5 border border-black/5 text-gray-600 hover:text-gray-900 rounded-md p-1.5 dark:bg-primary-300/10 dark:border-white/10 dark:text-gray-400 dark:hover:text-gray-50"
|
||||||
title="Copy code"
|
title="{{ $copyCode }}"
|
||||||
data-clipboard-target="#code-block-{{ .Ordinal }}"
|
|
||||||
>
|
>
|
||||||
<div class="group-[.copied]/copybtn:hidden copy-icon pointer-events-none h-4 w-4"></div>
|
<div class="group-[.copied]/copybtn:hidden copy-icon pointer-events-none h-4 w-4"></div>
|
||||||
<div class="hidden group-[.copied]/copybtn:block success-icon pointer-events-none h-4 w-4"></div>
|
<div class="hidden group-[.copied]/copybtn:block success-icon pointer-events-none h-4 w-4"></div>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{{- $alt := .PlainText | safeHTML -}}
|
{{- $alt := .PlainText | safeHTML -}}
|
||||||
{{- $lazyLoading := .Page.Site.Params.enableImagelazyLoading | default true -}}
|
{{- $lazyLoading := .Page.Site.Params.enableImageLazyLoading | default true -}}
|
||||||
{{- $dest := .Destination -}}
|
{{- $dest := .Destination -}}
|
||||||
|
|
||||||
{{- $isRemote := not (urls.Parse $dest).Scheme -}}
|
{{- $isLocal := not (urls.Parse $dest).Scheme -}}
|
||||||
{{- $isPage := and (eq .Page.Kind "page") (not .Page.BundleType) -}}
|
{{- $isPage := and (eq .Page.Kind "page") (not .Page.BundleType) -}}
|
||||||
{{- $startsWithSlash := hasPrefix $dest "/" -}}
|
{{- $startsWithSlash := hasPrefix $dest "/" -}}
|
||||||
{{- $startsWithRelative := hasPrefix $dest "../" -}}
|
{{- $startsWithRelative := hasPrefix $dest "../" -}}
|
||||||
|
|
||||||
{{- if and $dest $isRemote -}}
|
{{- if and $dest $isLocal -}}
|
||||||
{{- if $startsWithSlash -}}
|
{{- if $startsWithSlash -}}
|
||||||
{{/* Images under static directory */}}
|
{{/* Images under static directory */}}
|
||||||
{{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
|
{{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
|
||||||
|
@ -1,27 +1,40 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class='mx-auto flex {{ partial "utils/page-width" . }}'>
|
<div class="mx-auto flex {{ partial `utils/page-width` . }}">
|
||||||
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
||||||
{{ partial "toc.html" . }}
|
{{ partial "toc.html" . }}
|
||||||
<article class="w-full break-words flex min-h-[calc(100vh-var(--navbar-height))] min-w-0 justify-center pb-8 pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="w-full break-words flex min-h-[calc(100vh-var(--navbar-height))] min-w-0 justify-center pb-8 pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
<main class="w-full min-w-0 max-w-6xl px-6 pt-4 md:px-12">
|
<main class="w-full min-w-0 max-w-6xl px-6 pt-4 md:px-12">
|
||||||
{{ partial "breadcrumb.html" . }}
|
{{ partial "breadcrumb.html" . }}
|
||||||
<h1 class="mt-2 text-4xl font-bold tracking-tight text-slate-900 dark:text-slate-100">{{ .Title }}</h1>
|
<h1 class="mt-2 text-4xl font-bold tracking-tight text-slate-900 dark:text-slate-100">{{ .Title }}</h1>
|
||||||
{{ with $date := .Date }}
|
<div class="mt-4 mb-16 text-gray-500 text-sm flex items-center flex-wrap gap-y-2">
|
||||||
<div class="mt-4 mb-16 text-gray-500 text-sm">
|
{{- with $date := .Date }}<span class="mr-1">{{ partial "utils/format-date" $date }}</span>{{ end -}}
|
||||||
{{ partial "utils/format-date" $date }}
|
{{- $lazyLoading := site.Params.enableImageLazyLoading | default true -}}
|
||||||
{{- if $.Params.authors }} by {{ end -}}
|
{{ if and .Date .Params.authors }}<span class="mx-1">·</span>{{ end -}}
|
||||||
{{- with $.Params.authors -}}
|
{{- with $.Params.authors -}}
|
||||||
{{- range $i, $author := . -}}
|
{{- range $i, $author := . -}}
|
||||||
{{- if $i }},{{ end -}}
|
{{- if reflect.IsMap $author -}}
|
||||||
{{- if $author.link -}}
|
{{- if and $i (not $author.image) }}<span class="mr-1">,</span>{{ end -}}
|
||||||
<a href="{{ $author.link }}" target="_blank" class="mx-1 text-current underline [text-underline-position:from-font] decoration-from-font">{{ $author.name }}</a>
|
<a
|
||||||
{{- else -}}
|
{{ with $author.link }}href="{{ . }}" target="_blank"{{ end }}
|
||||||
<span>{{ $author.name }}</span>
|
class="group inline-flex items-center text-current gap-x-1.5 mx-1"
|
||||||
{{- end -}}
|
{{ with $author.name }}title="{{ . }}"{{ end }}
|
||||||
|
>
|
||||||
|
{{- with $image := $author.image }}
|
||||||
|
{{- $isLocal := not (urls.Parse $image).Scheme -}}
|
||||||
|
{{- $startsWithSlash := hasPrefix $image "/" -}}
|
||||||
|
{{- if and $isLocal $startsWithSlash }}
|
||||||
|
{{- $image = (relURL (strings.TrimPrefix "/" $image)) -}}
|
||||||
|
{{ end -}}
|
||||||
|
<img src="{{ $image | safeURL }}" alt="{{ $author.name }}" class="inline-block h-4 w-4 rounded-full" {{ if $lazyLoading }}loading="lazy"{{ end }} />
|
||||||
|
{{ end -}}
|
||||||
|
<div class="group-hover:underline">{{ $author.name }}</div>
|
||||||
|
</a>
|
||||||
|
{{- else -}}
|
||||||
|
{{- if $i }}<span class="mr-1">,</span>{{ end -}}<span class="mx-1">{{ $author }}</span>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</div>
|
{{- end -}}
|
||||||
{{ end }}
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,9 +36,11 @@
|
|||||||
|
|
||||||
{{- define "theme-credit" -}}
|
{{- define "theme-credit" -}}
|
||||||
<a class="flex text-sm items-center gap-1 text-current" target="_blank" rel="noopener noreferrer" title="Hextra GitHub Homepage" href="https://github.com/imfing/hextra">
|
<a class="flex text-sm items-center gap-1 text-current" target="_blank" rel="noopener noreferrer" title="Hextra GitHub Homepage" href="https://github.com/imfing/hextra">
|
||||||
<span
|
<span>
|
||||||
>{{ . | safeHTML }}
|
{{- . | markdownify -}}
|
||||||
{{- partial "utils/icon.html" (dict "name" "hextra" "attributes" "height=1em class=\"inline-block ml-1 align-text-bottom\"") -}}
|
{{- if strings.Contains . "Hextra" -}}
|
||||||
|
{{- partial "utils/icon.html" (dict "name" "hextra" "attributes" `height=1em class="inline-block ml-1 align-[-2.5px]"`) -}}
|
||||||
|
{{- end -}}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -32,10 +32,18 @@
|
|||||||
{{- if eq .Params.type "search" -}}
|
{{- if eq .Params.type "search" -}}
|
||||||
{{- partial "search.html" (dict "params" .Params) -}}
|
{{- partial "search.html" (dict "params" .Params) -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $external := strings.HasPrefix .URL "http" -}}
|
{{- $link := .URL -}}
|
||||||
|
{{- $external := strings.HasPrefix $link "http" -}}
|
||||||
|
{{- with .PageRef -}}
|
||||||
|
{{- if hasPrefix . "/" -}}
|
||||||
|
{{- $link = relLangURL (strings.TrimPrefix "/" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/* Display icon menu item */}}
|
{{/* Display icon menu item */}}
|
||||||
{{- if .Params.icon -}}
|
{{- if .Params.icon -}}
|
||||||
<a class="p-2 text-current" {{ if $external }}target="_blank" rel="noreferer"{{ end }} href="{{ .URL | relLangURL }}" title="{{ or (T .Identifier) .Name | safeHTML }}">
|
{{- $rel := cond (eq .Params.icon "mastodon") "noreferer me" "noreferer" }}
|
||||||
|
<a class="p-2 text-current" {{ if $external }}target="_blank" rel="{{ $rel }}"{{ end }} href="{{ $link }}" title="{{ or (T .Identifier) .Name | safeHTML }}">
|
||||||
{{- partial "utils/icon.html" (dict "name" .Params.icon "attributes" "height=24") -}}
|
{{- partial "utils/icon.html" (dict "name" .Params.icon "attributes" "height=24") -}}
|
||||||
<span class="sr-only">{{ or (T .Identifier) .Name | safeHTML }}</span>
|
<span class="sr-only">{{ or (T .Identifier) .Name | safeHTML }}</span>
|
||||||
</a>
|
</a>
|
||||||
@ -44,7 +52,7 @@
|
|||||||
{{- $activeClass := cond $active "font-medium" "text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200" -}}
|
{{- $activeClass := cond $active "font-medium" "text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200" -}}
|
||||||
<a
|
<a
|
||||||
title="{{ or (T .Identifier) .Name | safeHTML }}"
|
title="{{ or (T .Identifier) .Name | safeHTML }}"
|
||||||
href="{{ .URL | relLangURL }}"
|
href="{{ $link }}"
|
||||||
{{ if $external }}target="_blank" rel="noreferer"{{ end }}
|
{{ if $external }}target="_blank" rel="noreferer"{{ end }}
|
||||||
class="text-sm contrast-more:text-gray-700 contrast-more:dark:text-gray-100 relative -ml-2 hidden whitespace-nowrap p-2 md:inline-block {{ $activeClass }}"
|
class="text-sm contrast-more:text-gray-700 contrast-more:dark:text-gray-100 relative -ml-2 hidden whitespace-nowrap p-2 md:inline-block {{ $activeClass }}"
|
||||||
>
|
>
|
||||||
|
@ -6,10 +6,16 @@
|
|||||||
{{- $sidebarClass := cond $disableSidebar (cond $displayPlaceholder "md:hidden xl:block" "md:hidden") "md:sticky" -}}
|
{{- $sidebarClass := cond $disableSidebar (cond $displayPlaceholder "md:hidden xl:block" "md:hidden") "md:sticky" -}}
|
||||||
|
|
||||||
{{- $navRoot := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}}
|
{{- $navRoot := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}}
|
||||||
{{- $navPages := union $navRoot.RegularPages $navRoot.Sections -}}
|
|
||||||
{{- $pageURL := $context.RelPermalink -}}
|
{{- $pageURL := $context.RelPermalink -}}
|
||||||
|
|
||||||
|
{{/* EXPERIMENTAL */}}
|
||||||
|
{{- if .context.Params.sidebar.hide -}}
|
||||||
|
{{- $disableSidebar = true -}}
|
||||||
|
{{- $displayPlaceholder = true -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
|
||||||
|
<div class="mobile-menu-overlay [transition:background-color_1.5s_ease] fixed inset-0 z-10 bg-black/80 dark:bg-black/60 hidden"></div>
|
||||||
<aside class="sidebar-container flex flex-col print:hidden md:top-16 md:shrink-0 md:w-64 md:self-start max-md:[transform:translate3d(0,-100%,0)] {{ $sidebarClass }}">
|
<aside class="sidebar-container flex flex-col print:hidden md:top-16 md:shrink-0 md:w-64 md:self-start max-md:[transform:translate3d(0,-100%,0)] {{ $sidebarClass }}">
|
||||||
<!-- Search bar on small screen -->
|
<!-- Search bar on small screen -->
|
||||||
<div class="px-4 pt-4 md:hidden">
|
<div class="px-4 pt-4 md:hidden">
|
||||||
@ -67,17 +73,24 @@
|
|||||||
{{- $toc := .toc | default false -}}
|
{{- $toc := .toc | default false -}}
|
||||||
|
|
||||||
{{- with $items := union .context.RegularPages .context.Sections -}}
|
{{- with $items := union .context.RegularPages .context.Sections -}}
|
||||||
|
{{- $items = where $items "Params.sidebar.exclude" "!=" true -}}
|
||||||
{{- if eq $level 0 -}}
|
{{- if eq $level 0 -}}
|
||||||
{{- range $items.ByWeight }}
|
{{- range $items.ByWeight }}
|
||||||
{{- $active := eq $pageURL .RelPermalink -}}
|
{{- if .Params.sidebar.separator -}}
|
||||||
{{- $shouldOpen := or (.Params.sidebar.open) (.IsAncestor $page) $active | default true }}
|
<li class="[word-break:break-word] mt-5 mb-2 px-2 py-1.5 text-sm font-semibold text-gray-900 first:mt-0 dark:text-gray-100">
|
||||||
<li class="{{ if $shouldOpen }}open{{ end }}">
|
<span class="cursor-default">{{ .LinkTitle }}</span>
|
||||||
{{- template "sidebar-item-link" dict "context" . "active" $active "title" .LinkTitle "link" .RelPermalink -}}
|
</li>
|
||||||
{{- if and $toc $active -}}
|
{{- else -}}
|
||||||
{{- template "sidebar-toc" dict "page" . -}}
|
{{- $active := eq $pageURL .RelPermalink -}}
|
||||||
{{- end -}}
|
{{- $shouldOpen := or (.Params.sidebar.open) (.IsAncestor $page) $active | default true }}
|
||||||
{{- template "sidebar-tree" dict "context" . "page" $page "pageURL" $pageURL "level" (add $level 1) "toc" $toc -}}
|
<li class="{{ if $shouldOpen }}open{{ end }}">
|
||||||
</li>
|
{{- template "sidebar-item-link" dict "context" . "active" $active "title" .LinkTitle "link" .RelPermalink -}}
|
||||||
|
{{- if and $toc $active -}}
|
||||||
|
{{- template "sidebar-toc" dict "page" . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- template "sidebar-tree" dict "context" . "page" $page "pageURL" $pageURL "level" (add $level 1) "toc" $toc -}}
|
||||||
|
</li>
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
<div class="ltr:pr-0 overflow-hidden">
|
<div class="ltr:pr-0 overflow-hidden">
|
||||||
@ -110,7 +123,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href="#{{ anchorize .ID }}"
|
href="#{{ anchorize .ID }}"
|
||||||
class="flex rounded px-2 py-1.5 text-sm transition-colors [word-break:break-word] cursor-pointer [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] contrast-more:border flex gap-2 before:opacity-25 before:content-['#'] text-gray-500 hover:bg-gray-100 hover:text-gray-900 dark:text-neutral-400 dark:hover:bg-primary-100/5 dark:hover:text-gray-50 contrast-more:text-gray-900 contrast-more:dark:text-gray-50 contrast-more:border-transparent contrast-more:hover:border-gray-900 contrast-more:dark:hover:border-gray-50"
|
class="flex rounded px-2 py-1.5 text-sm transition-colors [word-break:break-word] cursor-pointer [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] contrast-more:border gap-2 before:opacity-25 before:content-['#'] text-gray-500 hover:bg-gray-100 hover:text-gray-900 dark:text-neutral-400 dark:hover:bg-primary-100/5 dark:hover:text-gray-50 contrast-more:text-gray-900 contrast-more:dark:text-gray-50 contrast-more:border-transparent contrast-more:hover:border-gray-900 contrast-more:dark:hover:border-gray-50"
|
||||||
>
|
>
|
||||||
{{- .Title -}}
|
{{- .Title -}}
|
||||||
</a>
|
</a>
|
||||||
@ -152,17 +165,13 @@
|
|||||||
{{- with .context }}
|
{{- with .context }}
|
||||||
{{- if or .RegularPages .Sections }}
|
{{- if or .RegularPages .Sections }}
|
||||||
<span class="hextra-sidebar-collapsible-button">
|
<span class="hextra-sidebar-collapsible-button">
|
||||||
{{- template "sidebear-collapsible-button" -}}
|
{{- template "sidebar-collapsible-button" -}}
|
||||||
</span>
|
</span>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
</a>
|
</a>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "sidebar-separator" -}}
|
{{- define "sidebar-collapsible-button" -}}
|
||||||
<div class="mt-4 border-t py-4 dark:border-neutral-800 contrast-more:border-neutral-400 dark:contrast-more:border-neutral-400" />
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- define "sidebear-collapsible-button" -}}
|
|
||||||
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="h-[18px] min-w-[18px] rounded-sm p-0.5 hover:bg-gray-800/5 dark:hover:bg-gray-100/5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" class="origin-center transition-transform rtl:-rotate-180"></path></svg>
|
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="h-[18px] min-w-[18px] rounded-sm p-0.5 hover:bg-gray-800/5 dark:hover:bg-gray-100/5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" class="origin-center transition-transform rtl:-rotate-180"></path></svg>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
{{- if site.Params.editURL.enable -}}
|
{{- if site.Params.editURL.enable -}}
|
||||||
{{- $editURL := site.Params.editURL.base | default "" -}}
|
{{- $editURL := site.Params.editURL.base | default "" -}}
|
||||||
{{- with .File -}}{{ $editURL = urls.JoinPath $editURL (replace .Path "\\" "/") }}{{- end -}}
|
{{- with .File -}}{{ $editURL = urls.JoinPath $editURL (replace .Path "\\" "/") }}{{- end -}}
|
||||||
{{- with .Params.editURL -}}{{ $editURL = .Params.editURL }}{{- end -}}
|
{{- with .Params.editURL -}}{{ $editURL = . }}{{- end -}}
|
||||||
<a class="text-xs font-medium text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100 contrast-more:text-gray-800 contrast-more:dark:text-gray-50" href="{{ $editURL }}" target="_blank" rel="noreferer">{{ $editThisPage }}</a>
|
<a class="text-xs font-medium text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100 contrast-more:text-gray-800 contrast-more:dark:text-gray-50" href="{{ $editURL }}" target="_blank" rel="noreferer">{{ $editThisPage }}</a>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{/* Scroll To Top */}}
|
{{/* Scroll To Top */}}
|
||||||
@ -59,7 +59,7 @@
|
|||||||
{{- if .Title }}
|
{{- if .Title }}
|
||||||
<li class="my-2 scroll-my-6 scroll-py-6">
|
<li class="my-2 scroll-my-6 scroll-py-6">
|
||||||
<a class="{{ $class }} inline-block text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300 contrast-more:text-gray-900 contrast-more:underline contrast-more:dark:text-gray-50 w-full break-words" href="#{{ anchorize .ID }}">
|
<a class="{{ $class }} inline-block text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300 contrast-more:text-gray-900 contrast-more:underline contrast-more:dark:text-gray-50 w-full break-words" href="#{{ anchorize .ID }}">
|
||||||
{{- .Title | safeHTML | plainify }}
|
{{- .Title | safeHTML | plainify | htmlUnescape }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -35,12 +35,12 @@
|
|||||||
{{ $headingTitle := index $headingTitles $i }}
|
{{ $headingTitle := index $headingTitles $i }}
|
||||||
|
|
||||||
{{ if eq $i 0 }}
|
{{ if eq $i 0 }}
|
||||||
{{ $data = $data | merge (dict $headingKey ($content | markdownify | plainify | htmlUnescape | chomp)) }}
|
{{ $data = $data | merge (dict $headingKey ($content | $page.RenderString | plainify | htmlUnescape | chomp)) }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ $parts := split $content (printf "\n%s\n" $headingTitle) }}
|
{{ $parts := split $content (printf "\n%s\n" $headingTitle) }}
|
||||||
{{ $lastPart := index $parts (sub (len $parts) 1) }}
|
{{ $lastPart := index $parts (sub (len $parts) 1) }}
|
||||||
|
|
||||||
{{ $data = $data | merge (dict $headingKey ($lastPart | markdownify | plainify | htmlUnescape | chomp)) }}
|
{{ $data = $data | merge (dict $headingKey ($lastPart | $page.RenderString | plainify | htmlUnescape | chomp)) }}
|
||||||
{{ $content = strings.TrimSuffix $lastPart $content }}
|
{{ $content = strings.TrimSuffix $lastPart $content }}
|
||||||
{{ $content = strings.TrimSuffix (printf "\n%s\n" $headingTitle) $content }}
|
{{ $content = strings.TrimSuffix (printf "\n%s\n" $headingTitle) $content }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -79,3 +79,4 @@
|
|||||||
<div class="line-clamp-3 text-sm font-normal text-gray-500 dark:text-gray-400 px-4 mb-4 mt-2">{{- $subtitle | markdownify -}}</div>
|
<div class="line-clamp-3 text-sm font-normal text-gray-500 dark:text-gray-400 px-4 mb-4 mt-2">{{- $subtitle | markdownify -}}</div>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</a>
|
</a>
|
||||||
|
{{- /* Strip trailing newline. */ -}}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ $rows := .Get "rows" | default "3" }}
|
{{ $rows := .Get "rows" | default "3" }}
|
||||||
|
|
||||||
<div class="hextra-cards mt-4 gap-4 grid not-prose" style="--rows: {{ $rows }};">
|
<div class="hextra-cards mt-4 gap-4 grid not-prose" style="--rows: {{ $rows }};">
|
||||||
{{ .Inner }}
|
{{- .Inner -}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
{{- $external := hasPrefix $link "http" -}}
|
{{- $external := hasPrefix $link "http" -}}
|
||||||
{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}}
|
{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}}
|
||||||
|
|
||||||
|
{{- if hasPrefix $image "/" -}}
|
||||||
|
{{- $image = relURL (strings.TrimPrefix "/" $image) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
<a
|
<a
|
||||||
{{ with $link }}href="{{ $href }}" {{ with $external }} target="_blank" rel="noreferrer"{{ end }}{{ end }}
|
{{ with $link }}href="{{ $href }}" {{ with $external }} target="_blank" rel="noreferrer"{{ end }}{{ end }}
|
||||||
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
||||||
|
22
layouts/shortcodes/include.html
Normal file
22
layouts/shortcodes/include.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{{- /*
|
||||||
|
https://github.com/gohugoio/gohugoioTheme/blob/master/layouts/shortcodes/include.html
|
||||||
|
|
||||||
|
Renders the page using the RenderShortcode method on the Page object.
|
||||||
|
|
||||||
|
You must call this shortcode using the {{% %}} notation.
|
||||||
|
|
||||||
|
@param {string} (postional parameter 0) The path to the page, relative to the content directory.
|
||||||
|
@returns template.HTML
|
||||||
|
|
||||||
|
@example {{% include "functions/_common/glob-patterns" %}}
|
||||||
|
*/}}
|
||||||
|
|
||||||
|
{{- with .Get 0 }}
|
||||||
|
{{- with site.GetPage . }}
|
||||||
|
{{- .RenderShortcodes }}
|
||||||
|
{{- else }}
|
||||||
|
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
{{- errorf "The %q shortcode requires a positional parameter indicating the path of the file to include. See %s" .Name .Position }}
|
||||||
|
{{- end }}
|
Reference in New Issue
Block a user