From 50d4a970bb8bd170506cdaf41f4ca78c0d77f6f0 Mon Sep 17 00:00:00 2001 From: Attila Greguss Date: Thu, 2 Jan 2025 17:51:52 +0000 Subject: [PATCH 1/2] Add recent shortcode and section --- assets/css/custom.css | 4 + content/_index.md | 130 ++++++++++--------- layouts/shortcodes/netduma/recents-list.html | 93 +++++++++++++ 3 files changed, 169 insertions(+), 58 deletions(-) create mode 100644 layouts/shortcodes/netduma/recents-list.html diff --git a/assets/css/custom.css b/assets/css/custom.css index 9fbbc62..1e46323 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -21,3 +21,7 @@ .hextra-footer:is(html[class~="dark"] *) { background-color: transparent; } + +.hextra-tabs-panel { + padding-top: 0; +} diff --git a/content/_index.md b/content/_index.md index bdcca6a..490df1c 100644 --- a/content/_index.md +++ b/content/_index.md @@ -19,66 +19,80 @@ layout: index {{< netduma/hero-button text="View Docs" link="docs" >}} -
-{{< hextra/feature-grid class="hx-mt-8">}} - {{< netduma/feature-card - link="/docs/dumaos-4/" - title="DumaOS 4" - subtitle="The latest version of DumaOS, featuring groundbreaking new features like SmartBOOST and Geo-Filter 2.0." - class="dark:hover:hx-bg-neutral-900" - image="/images/dumaos_4_logo.png" - imageClass="max-w-full" - style="background: radial-gradient(ellipse at 50% 80%,rgba(255,70,78,0.15),hsla(0,0%,100%,0));" - >}} - {{< netduma/feature-card - link="/docs/dumaos-3/" - title="DumaOS 3.0" - subtitle="The version of DumaOS which shipped with the Netduma R2 and Nighthawk Pro Gaming routers." - class="dark:hover:hx-bg-neutral-900" - image="/images/dumaos_3_logo.png" - imageClass="max-w-full" - style="background: radial-gradient(ellipse at 50% 80%,rgba(255,70,78,0.15),hsla(0,0%,100%,0));" - >}} - {{< netduma/feature-card - link="/docs/telstra-game-optimiser/" - title="Telstra" - subtitle="Telstra Internet Optimiser brings the power of DumaOS to your Telstra Smart Modem." - class="dark:hover:hx-bg-neutral-900" - image="/images/telstra_logo.png" - imageClass="max-w-full" - style="background: radial-gradient(ellipse at 50% 80%,rgba(89,112,255,0.15),hsla(0,0%,100%,0));" +
+
+
+ {{< hextra/feature-grid class="hx-mt-8">}} + {{< netduma/feature-card + link="/docs/dumaos-4/" + title="DumaOS 4" + subtitle="The latest version of DumaOS, featuring groundbreaking new features like SmartBOOST and Geo-Filter 2.0." + class="dark:hover:hx-bg-neutral-900" + image="/images/dumaos_4_logo.png" + imageClass="max-w-full" + style="background: radial-gradient(ellipse at 50% 80%,rgba(255,70,78,0.15),hsla(0,0%,100%,0));" + >}} + {{< netduma/feature-card + link="/docs/dumaos-3/" + title="DumaOS 3.0" + subtitle="The version of DumaOS which shipped with the Netduma R2 and Nighthawk Pro Gaming routers." + class="dark:hover:hx-bg-neutral-900" + image="/images/dumaos_3_logo.png" + imageClass="max-w-full" + style="background: radial-gradient(ellipse at 50% 80%,rgba(255,70,78,0.15),hsla(0,0%,100%,0));" + >}} + {{< netduma/feature-card + link="/docs/telstra-game-optimiser/" + title="Telstra" + subtitle="Telstra Internet Optimiser brings the power of DumaOS to your Telstra Smart Modem." + class="dark:hover:hx-bg-neutral-900" + image="/images/telstra_logo.png" + imageClass="max-w-full" + style="background: radial-gradient(ellipse at 50% 80%,rgba(89,112,255,0.15),hsla(0,0%,100%,0));" - >}} -{{< /hextra/feature-grid >}} -
+ >}} + {{< /hextra/feature-grid >}} +
+ +
+ {{< hextra/feature-grid cols="3">}} + {{< netduma/feature-card + link="/frequently-asked-questions" + title="FAQ" + subtitle="Frequently asked questions about Netduma and DumaOS." + class="dark:hx-bg-neutral-900 dark:hover:hx-bg-neutral-800" + >}} + {{< netduma/feature-card + link="/firmwares/" + title="Firmwares" + subtitle="Download the latest updates for DumaOS." + class="dark:hx-bg-neutral-900 dark:hover:hx-bg-neutral-800" + >}} + {{< netduma/feature-card + link="/docs/user-manuals/" + title="User Manuals" + subtitle="User manuals that are provided with DumaOS compatible hardware." + class="dark:hx-bg-neutral-900 dark:hover:hx-bg-neutral-800" + >}} + + {{< /hextra/feature-grid >}} +
+
-
-{{< hextra/feature-grid cols="3">}} - {{< netduma/feature-card - link="/frequently-asked-questions" - title="FAQ" - subtitle="Frequently asked questions about Netduma and DumaOS." - class="dark:hx-bg-neutral-900 dark:hover:hx-bg-neutral-800" - >}} - {{< netduma/feature-card - link="/firmwares/" - title="Firmwares" - subtitle="Download the latest updates for DumaOS." - class="dark:hx-bg-neutral-900 dark:hover:hx-bg-neutral-800" - >}} - {{< netduma/feature-card - link="/docs/user-manuals/" - title="User Manuals" - subtitle="User manuals that are provided with DumaOS compatible hardware." - class="dark:hx-bg-neutral-900 dark:hover:hx-bg-neutral-800" - >}} - -{{< /hextra/feature-grid >}} +
+ {{< tabs items="RECENT" >}} + {{< tab >}} +
+ {{< netduma/recents-list>}} +
+ {{< /tab >}} + {{< /tabs >}} +
## Further Support diff --git a/layouts/shortcodes/netduma/recents-list.html b/layouts/shortcodes/netduma/recents-list.html new file mode 100644 index 0000000..ef03e91 --- /dev/null +++ b/layouts/shortcodes/netduma/recents-list.html @@ -0,0 +1,93 @@ +{{/* FlexSearch Index Data */}} +{{- $indexType := site.Params.search.flexsearch.index | default "content" -}} + +{{- if not (in (slice "content" "summary" "heading" "title" ) $indexType) -}} + {{- errorf "unknown flexsearch index type: %s" $indexType -}} +{{- end -}} + +{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}} +{{- $pages = where $pages "Params.excludeSearch" "!=" true -}} +{{- $pages = where $pages "Content" "!=" "" -}} + +{{- $pageData := dict -}} + +{{- range $index, $page := $pages -}} + {{- $pageTitle := $page.LinkTitle | default $page.File.BaseFileName -}} + {{- $pageLink := $page.RelPermalink -}} + {{- $updated := $page.Lastmod -}} + {{- $pageData = $pageData | merge (dict $pageLink (dict "link" $pageLink "title" $pageTitle "updated" $updated)) -}} +{{- end -}} + + +{{- $output := dict -}} +{{- range $index, $item := $pageData -}} + {{- if not $item.updated -}} + {{- continue -}} + {{- end -}} + + {{- $urlParts := split $item.link "/" -}} + {{- $parts := slice -}} + {{- range $index, $part := $urlParts -}} + {{- if eq $part "" -}} + {{- continue -}} + {{- end -}} + + + {{- if strings.HasPrefix $part "#" -}} + {{- continue -}} + {{- end -}} + + {{- $parts = $parts | append $part -}} + {{- end -}} + {{- $urlParts = $parts -}} + + + {{- if lt (len $urlParts) 2 -}} + {{- continue -}} + {{- end -}} + + {{- $parentLink := "" -}} + {{- range $index, $part := first (sub (len $urlParts) 1) $urlParts -}} + {{- $parentLink = (printf "%s/%s" $parentLink $part) -}} + {{- end -}} + + + {{- if not (strings.HasSuffix $parentLink "/") -}} + {{- $parentLink = (printf "%s/" $parentLink) -}} + {{- end -}} + + + {{- if eq $parentLink "/" -}} + {{- continue -}} + {{- end -}} + + + {{- $parentItem := index $pageData $parentLink -}} + + {{- if not $parentItem -}} + + {{- continue -}} + {{- end -}} + + {{- if $parentItem -}} + + {{- $output = $output | merge (dict $item.link (dict "link" $item.link "title" $item.title "updated" $item.updated "parentTitle" $parentItem.title)) -}} + {{- end -}} + +{{- end -}} + +{{- $output := sort $output "updated" "desc" -}} + +
+{{- range $index, $item := first 5 $output -}} + {{- if $item.updated -}} + + {{- $item.title -}} + {{- $item.parentTitle -}} + + {{- end -}} +{{- end -}} +
\ No newline at end of file From e267850e6518c01a4c4f33a33f7f76f8dfb985bc Mon Sep 17 00:00:00 2001 From: Attila Greguss Date: Mon, 20 Jan 2025 15:39:46 +0000 Subject: [PATCH 2/2] Comment out recents --- content/_index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/_index.md b/content/_index.md index 490df1c..25feb43 100644 --- a/content/_index.md +++ b/content/_index.md @@ -84,7 +84,7 @@ layout: index
-
+
## Further Support