From 87b099de1cb5ad53a339d2addf894d681a862b5d Mon Sep 17 00:00:00 2001 From: MuhammadAashirAslam Date: Wed, 15 Jul 2026 17:56:25 +0500 Subject: [PATCH] Add core page layout partials --- layouts/partials/breadcrumb.html | 35 ++++++++++++ layouts/partials/footer.html | 50 ++++++++++++++++ layouts/partials/head.html | 89 +++++++++++++++++++++++++++++ layouts/partials/head_print.html | 50 ++++++++++++++++ layouts/partials/scroll_to_top.html | 45 +++++++++++++++ layouts/partials/toc.html | 5 ++ layouts/partials/topnav.html | 77 +++++++++++++++++++++++++ 7 files changed, 351 insertions(+) create mode 100644 layouts/partials/breadcrumb.html create mode 100644 layouts/partials/footer.html create mode 100644 layouts/partials/head.html create mode 100644 layouts/partials/head_print.html create mode 100644 layouts/partials/scroll_to_top.html create mode 100644 layouts/partials/toc.html create mode 100644 layouts/partials/topnav.html diff --git a/layouts/partials/breadcrumb.html b/layouts/partials/breadcrumb.html new file mode 100644 index 00000000000..0a008cb8723 --- /dev/null +++ b/layouts/partials/breadcrumb.html @@ -0,0 +1,35 @@ +{{- $topnavKey := .Param "topnav" | default "topnav" -}} +{{- $topnav := index hugo.Data $topnavKey | default hugo.Data.topnav -}} +{{- $sectionTitle := "" -}} +{{- $sectionURL := "" -}} +{{- range $entry := $topnav.topnav -}} + {{- range $item := $entry.items -}} + {{- $sectionSidebar := printf "%s_sidebar" ($item.section | default "") -}} + {{- if or (and $item.url (in $.RelPermalink $item.url)) (eq ($.Param "sidebar") $sectionSidebar) -}} + {{- $sectionTitle = $item.title -}} + {{- $sectionURL = $item.url -}} + {{- end -}} + {{- end -}} +{{- end -}} + diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 00000000000..be793a0cc36 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,50 @@ + diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 00000000000..8e9470dc20a --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,89 @@ +{{- $siteTitle := site.Title -}} +{{- with site.Params.site_title }}{{ $siteTitle = . }}{{ end -}} +{{- $title := $siteTitle -}} +{{- if and .Title (not .IsHome) }}{{ $title = printf "%s | %s" .Title $siteTitle }}{{ end -}} +{{- $description := "" -}} +{{- with .Params.summary }}{{ $description = plainify . }}{{ else }}{{ with site.Params.description }}{{ $description = plainify . }}{{ end }}{{ end -}} + + +{{ with $description }}{{ end }} +{{ with .Params.tags }}{{ end }} + +{{ $title }} + + + + + + + + + +{{ with $description }}{{ end }} + + +{{ with $description }}{{ end }} + + + + + + + + + + +{{ if .IsHome }}{{ end }} + + + +{{ block "head_extra" . }}{{ end }} + + + + + +{{ with site.Params.mermaid.src }}{{ end }} + + + + + + + + + + diff --git a/layouts/partials/head_print.html b/layouts/partials/head_print.html new file mode 100644 index 00000000000..cf11b0ae672 --- /dev/null +++ b/layouts/partials/head_print.html @@ -0,0 +1,50 @@ +{{- $siteTitle := site.Title -}} +{{- with site.Params.site_title }}{{ $siteTitle = . }}{{ end -}} + + +{{ with .Params.summary }}{{ end }} +{{ with .Title }}{{ . }} | {{ end }}{{ $siteTitle }} + + + + + + + + + + + + + + + + + + + + diff --git a/layouts/partials/scroll_to_top.html b/layouts/partials/scroll_to_top.html new file mode 100644 index 00000000000..49633283ac9 --- /dev/null +++ b/layouts/partials/scroll_to_top.html @@ -0,0 +1,45 @@ + + + + + diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html new file mode 100644 index 00000000000..fe6eca3e3b1 --- /dev/null +++ b/layouts/partials/toc.html @@ -0,0 +1,5 @@ +{{- $toc := printf "%s" .TableOfContents -}} +{{- if and (ne (.Param "toc") false) (in $toc " + +