mirror of
https://github.com/imfing/hextra.git
synced 2025-07-13 18:51:41 -04:00
Compare commits
7 Commits
v0.8.5
...
a16ecd5fe5
Author | SHA1 | Date | |
---|---|---|---|
a16ecd5fe5 | |||
d68bfc006e | |||
680f108a1f | |||
133f8efb77 | |||
b4f6e2fd7a | |||
8954247842 | |||
875ccc58c2 |
@ -200,7 +200,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
cache: 100,
|
cache: 100,
|
||||||
document: {
|
document: {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
store: ['title', 'crumb'],
|
store: ['title'],
|
||||||
index: "content"
|
index: "content"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -210,7 +210,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
cache: 100,
|
cache: 100,
|
||||||
document: {
|
document: {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
store: ['title', 'content', 'url', 'display', 'crumb'],
|
store: ['title', 'content', 'url', 'display'],
|
||||||
index: "content",
|
index: "content",
|
||||||
tag: 'pageId'
|
tag: 'pageId'
|
||||||
}
|
}
|
||||||
@ -222,30 +222,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
for (const route in data) {
|
for (const route in data) {
|
||||||
let pageContent = '';
|
let pageContent = '';
|
||||||
++pageId;
|
++pageId;
|
||||||
const urlParts = route.split('/').filter(x => x != "" && !x.startsWith('#'));
|
|
||||||
|
|
||||||
let crumb = '';
|
|
||||||
let searchUrl = '/'
|
|
||||||
for (let i = 0; i < urlParts.length; i++) {
|
|
||||||
const urlPart = urlParts[i];
|
|
||||||
searchUrl += urlPart + '/'
|
|
||||||
|
|
||||||
const crumbData = data[searchUrl];
|
|
||||||
if (!crumbData) {
|
|
||||||
console.warn('Excluded page', searchUrl, '- will not be included for search result breadcrumb for', route);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let title = data[searchUrl].title;
|
|
||||||
if (title == "_index") {
|
|
||||||
title = urlPart.split("-").map(x => x).join(" ");
|
|
||||||
}
|
|
||||||
crumb += title;
|
|
||||||
|
|
||||||
if (i < urlParts.length - 1) {
|
|
||||||
crumb += ' > ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const heading in data[route].data) {
|
for (const heading in data[route].data) {
|
||||||
const [hash, text] = heading.split('#');
|
const [hash, text] = heading.split('#');
|
||||||
@ -259,7 +235,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
id: url,
|
id: url,
|
||||||
url,
|
url,
|
||||||
title,
|
title,
|
||||||
crumb,
|
|
||||||
pageId: `page_${pageId}`,
|
pageId: `page_${pageId}`,
|
||||||
content: title,
|
content: title,
|
||||||
...(paragraphs[0] && { display: paragraphs[0] })
|
...(paragraphs[0] && { display: paragraphs[0] })
|
||||||
@ -270,7 +245,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
id: `${url}_${i}`,
|
id: `${url}_${i}`,
|
||||||
url,
|
url,
|
||||||
title,
|
title,
|
||||||
crumb,
|
|
||||||
pageId: `page_${pageId}`,
|
pageId: `page_${pageId}`,
|
||||||
content: paragraphs[i]
|
content: paragraphs[i]
|
||||||
});
|
});
|
||||||
@ -282,7 +256,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
window.pageIndex.add({
|
window.pageIndex.add({
|
||||||
id: pageId,
|
id: pageId,
|
||||||
title: data[route].title,
|
title: data[route].title,
|
||||||
crumb,
|
|
||||||
content: pageContent
|
content: pageContent
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -335,7 +308,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
_page_rk: i,
|
_page_rk: i,
|
||||||
_section_rk: j,
|
_section_rk: j,
|
||||||
route: url,
|
route: url,
|
||||||
prefix: isFirstItemOfPage ? result.doc.crumb : undefined,
|
prefix: isFirstItemOfPage ? result.doc.title : undefined,
|
||||||
children: { title, content }
|
children: { title, content }
|
||||||
})
|
})
|
||||||
isFirstItemOfPage = false
|
isFirstItemOfPage = false
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
|
{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
|
||||||
{{- $pages = where $pages "Params.excludeSearch" "!=" true -}}
|
{{- $pages = where $pages "Params.excludeSearch" "!=" true -}}
|
||||||
|
{{- $pages = where $pages "Content" "!=" "" -}}
|
||||||
|
|
||||||
{{- $output := dict -}}
|
{{- $output := dict -}}
|
||||||
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
{{- $cols := .cols | default 3 -}}
|
|
||||||
{{- $content := .content -}}
|
|
||||||
|
|
||||||
<div class="hextra-cards hx-mt-4 hx-gap-4 hx-grid not-prose" style="--hextra-cards-grid-cols: {{ $cols }};">
|
|
||||||
{{- $content -}}
|
|
||||||
</div>
|
|
@ -1,3 +1,5 @@
|
|||||||
{{- $cols := .Get "cols" | default 3 -}}
|
{{- $cols := .Get "cols" | default 3 -}}
|
||||||
|
|
||||||
{{- partial "shortcodes/cards" (dict "cols" $cols "content" .Inner) -}}
|
<div class="hextra-cards hx-mt-4 hx-gap-4 hx-grid not-prose" style="--hextra-cards-grid-cols: {{ $cols }};">
|
||||||
|
{{- .Inner -}}
|
||||||
|
</div>
|
||||||
|
Reference in New Issue
Block a user