From 45c654698309decde74330c1677e6cc607a8212f Mon Sep 17 00:00:00 2001 From: madoke Date: Mon, 2 Jan 2023 00:58:45 +0000 Subject: [PATCH 01/12] Add support for subnavigation menu --- .../content/docs/getting-started/index.md | 14 ++++++- layouts/partials/header/basic.html | 41 +++++++++++++++++-- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/exampleSite/content/docs/getting-started/index.md b/exampleSite/content/docs/getting-started/index.md index 401ae1b5..379d8a6c 100644 --- a/exampleSite/content/docs/getting-started/index.md +++ b/exampleSite/content/docs/getting-started/index.md @@ -151,9 +151,9 @@ When you create a new taxonomy, you will need to adjust the navigation links on ## Menus -Blowfish has two menus that can be customised to suit the content and layout of your site. The `main` menu appears in the site header and the `footer` menu appears at the bottom of the page just above the copyright notice. +Blowfish has 3 menus that can be customised to suit the content and layout of your site. The `main` menu appears in the site header, the `subnavigation` menu just below `main` and the `footer` menu appears at the bottom of the page just above the copyright notice. -Both menus are configured in the `menus.en.toml` file. Similarly to the languages config file, if you wish to use another language, rename this file and replace `en` with the language code you wish to use. +All of them can be configured in the `menus.en.toml` file. Similarly to the languages config file, if you wish to use another language, rename this file and replace `en` with the language code you wish to use. ```toml # config/_default/menus.toml @@ -180,6 +180,16 @@ Both menus are configured in the `menus.en.toml` file. Similarly to the language url = "https://github.com/nunocoracao/blowfish" weight = 40 +[[subnavigation]] + name = "An interesting topic" + pageRef = "tags/interesting-topic" + weight = 10 + +[[subnavigation]] + name = "My Awesome Category" + pageRef = "categories/awesome" + weight = 20 + [[footer]] name = "Privacy" url = "https://external-link" diff --git a/layouts/partials/header/basic.html b/layouts/partials/header/basic.html index cb3b0d0c..489cef43 100644 --- a/layouts/partials/header/basic.html +++ b/layouts/partials/header/basic.html @@ -1,5 +1,5 @@
+ class="site-header flex items-center justify-between px-4 py-6 sm:px-6 md:justify-start space-x-3"> {{ if .Site.Params.Logo -}} {{ $logo := resources.Get .Site.Params.Logo }} {{ if $logo }} @@ -15,14 +15,14 @@ {{ end }} {{- end }}
-
\ No newline at end of file +
+ +{{ if .Site.Menus.subnavigation }} +
+ +
+{{ end }} From dfb18c126c217fd7edc98dacc62dfd5031faf0ea Mon Sep 17 00:00:00 2001 From: madoke Date: Fri, 6 Jan 2023 16:57:51 +0000 Subject: [PATCH 02/12] add nested menus capability --- assets/icons/chevron-down.svg | 12 ++++++ assets/js/header.js | 11 ++++++ layouts/partials/head.html | 8 +++- layouts/partials/header/README.md | 37 +++++++++++++++++++ layouts/partials/header/basic.html | 23 ++++-------- .../partials/header/header-option-nested.html | 32 ++++++++++++++++ .../partials/header/header-option-simple.html | 5 +++ layouts/partials/header/header-option.html | 5 +++ 8 files changed, 116 insertions(+), 17 deletions(-) create mode 100644 assets/icons/chevron-down.svg create mode 100644 assets/js/header.js create mode 100644 layouts/partials/header/README.md create mode 100644 layouts/partials/header/header-option-nested.html create mode 100644 layouts/partials/header/header-option-simple.html create mode 100644 layouts/partials/header/header-option.html diff --git a/assets/icons/chevron-down.svg b/assets/icons/chevron-down.svg new file mode 100644 index 00000000..9368d7fe --- /dev/null +++ b/assets/icons/chevron-down.svg @@ -0,0 +1,12 @@ + diff --git a/assets/js/header.js b/assets/js/header.js new file mode 100644 index 00000000..1e576c6c --- /dev/null +++ b/assets/js/header.js @@ -0,0 +1,11 @@ +function header_toggle_nested_menu(element) { + if (!element) { + throw new Error("Could not find button") + } + let parent_element = element.parentElement; + if(!parent_element) { + throw new Error("Could not get parent element from button") + } + let nested_menu = parent_element.querySelector(".header-nested-menu") + nested_menu.classList.toggle('hidden'); +} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 31db44bf..a85fd39c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -147,4 +147,10 @@ {{ end }} {{ end }} - \ No newline at end of file + + {{/* Header */}} + {{ $headerLib := resources.Get "js/header.js" }} + {{ $headerLib := $headerLib | resources.Minify }} + {{ $headerJS := $headerLib | resources.Fingerprint "sha512" }} + + diff --git a/layouts/partials/header/README.md b/layouts/partials/header/README.md new file mode 100644 index 00000000..e7845957 --- /dev/null +++ b/layouts/partials/header/README.md @@ -0,0 +1,37 @@ +# Header + +- `header-option-simple.html` renders menus without nested items +- `header-option-nested.html` renders menus with nested items +- `header-option.html` decides which template to render given the menu + +- `js/header.js` exposes a method to toggle visibility of nested menus + +- Nesting is configured using the `parent` and `identifier` properties in `menus.en.yml`. Example + +```yml +main: + - name: Product + identifier: product + weight: 1 + - name: Analytics + pageRef: analytics + weight: 1 + parent: product + - name: Engagement + pageRef: engagement + weight: 2 + parent: product + +secondary: + - name: Engineering + identifier: engineering + weight: 1 + - name: Computers + pageRef: computers + weight: 1 + parent: engineering + - name: Rockets + pageRef: rockets + weight: 2 + parent: engineering +``` diff --git a/layouts/partials/header/basic.html b/layouts/partials/header/basic.html index 3574ddc5..0a17c50e 100644 --- a/layouts/partials/header/basic.html +++ b/layouts/partials/header/basic.html @@ -22,18 +22,15 @@ - {{ end }} - +
@@ -143,13 +140,7 @@
diff --git a/layouts/partials/header/header-option-nested.html b/layouts/partials/header/header-option-nested.html new file mode 100644 index 00000000..87394963 --- /dev/null +++ b/layouts/partials/header/header-option-nested.html @@ -0,0 +1,32 @@ +
+ + +
diff --git a/layouts/partials/header/header-option-simple.html b/layouts/partials/header/header-option-simple.html new file mode 100644 index 00000000..fa36ac68 --- /dev/null +++ b/layouts/partials/header/header-option-simple.html @@ -0,0 +1,5 @@ + + {{ partial "icon.html" .Pre }} + {{ if and .Pre .Name }}   {{ end }} + {{ .Name | markdownify | emojify }} + diff --git a/layouts/partials/header/header-option.html b/layouts/partials/header/header-option.html new file mode 100644 index 00000000..2a27da7d --- /dev/null +++ b/layouts/partials/header/header-option.html @@ -0,0 +1,5 @@ +{{ if .HasChildren }} + {{ partial "header/header-option-nested.html" . }} +{{ else }} + {{ partial "header/header-option-simple.html" . }} +{{ end }} From f970b2b6d96b5f8df00acef4ce437af3faf30adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sun, 8 Jan 2023 22:15:54 +0000 Subject: [PATCH 03/12] :recycle: initial cleanup --- README.md | 1 + .../content/docs/getting-started/index.md | 50 ++++++++++++++----- layouts/partials/head.html | 11 ++-- 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index ac841281..38c7b56e 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Blowfish is designed to be a powerful, lightweight theme for [Hugo](https://gohu - Support for multiple authors - Support for series of articles - Flexible with any content types, taxonomies and menus +- Support for header, footer, and nested menus - Multilingual content support inlcuding support for RTL languages - Ability to link to posts on third-party websites - Buymeacoffee integration diff --git a/exampleSite/content/docs/getting-started/index.md b/exampleSite/content/docs/getting-started/index.md index 379d8a6c..3f6aaedf 100644 --- a/exampleSite/content/docs/getting-started/index.md +++ b/exampleSite/content/docs/getting-started/index.md @@ -151,9 +151,9 @@ When you create a new taxonomy, you will need to adjust the navigation links on ## Menus -Blowfish has 3 menus that can be customised to suit the content and layout of your site. The `main` menu appears in the site header, the `subnavigation` menu just below `main` and the `footer` menu appears at the bottom of the page just above the copyright notice. +Blowfish has two menus that can be customised to suit the content and layout of your site. The `main` menu appears in the site header and the `footer` menu appears at the bottom of the page just above the copyright notice. -All of them can be configured in the `menus.en.toml` file. Similarly to the languages config file, if you wish to use another language, rename this file and replace `en` with the language code you wish to use. +Both menus are configured in the `menus.en.toml` file. Similarly to the languages config file, if you wish to use another language, rename this file and replace `en` with the language code you wish to use. ```toml # config/_default/menus.toml @@ -180,16 +180,6 @@ All of them can be configured in the `menus.en.toml` file. Similarly to the lang url = "https://github.com/nunocoracao/blowfish" weight = 40 -[[subnavigation]] - name = "An interesting topic" - pageRef = "tags/interesting-topic" - weight = 10 - -[[subnavigation]] - name = "My Awesome Category" - pageRef = "categories/awesome" - weight = 20 - [[footer]] name = "Privacy" url = "https://external-link" @@ -205,6 +195,40 @@ Menu links will be sorted from lowest to highest `weight`, and then alphabetical Both menus are completely optional and can be commented out if not required. Use the template provided in the file as a guide. +### Nested Menus + +bla bla bla + +```toml +# config/_default/menus.toml + +[[main]] + name = "Blog" + pageRef = "posts" + weight = 10 + +[[main]] + name = "Topics" + pageRef = "topics" + weight = 20 + +[[main]] + pre = "github" + name = "GitHub" + url = "https://github.com/nunocoracao/blowfish" + weight = 30 + +[[main]] + identifier = "github2" + pre = "github" + url = "https://github.com/nunocoracao/blowfish" + weight = 40 + +[[footer]] + name = "Privacy" + url = "https://external-link" +``` + ## Thumbnails & Backgrounds Blowfish was built so it would be easy to add visual support to your articles. If your familiar with Hugo article strucutre, you just need to place an image file (almost all formats are supported bue we recommend `.png` or `.jpg`) that starts with `feature*` inside your article folder. And that's it, Blowfish will then able to both use the image as a thumbnail within your website as well as for oEmbed cards across social platforms. @@ -215,4 +239,4 @@ Additionally, Blowfish also supports background hero images in articles and list ## Detailed configuration -The steps above are the bare minimum configuration. If you now run `hugo server` you will be presented with a blank Blowfish website. Detailed configuration is covered in the [Configuration]({{< ref "configuration" >}}) section. +The steps above are the bare minimum configuration. If you now run `hugo server` you will be presented with a blank Blowfish website. Detailed configuration is covered in the [Configuration]({{< ref "configuration" >}}) section. \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index a85fd39c..839b554b 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -86,6 +86,11 @@ {{ end }} + {{/* Header */}} + {{ $headerLib := resources.Get "js/header.js" }} + {{ $headerLib := $headerLib | resources.Minify }} + {{ $headerJS := $headerLib | resources.Fingerprint "sha512" }} + {{/* Site Verification */}} {{ with .Site.Params.verification.google }} @@ -147,10 +152,4 @@ {{ end }} {{ end }} - - {{/* Header */}} - {{ $headerLib := resources.Get "js/header.js" }} - {{ $headerLib := $headerLib | resources.Minify }} - {{ $headerJS := $headerLib | resources.Fingerprint "sha512" }} - From d8e641dc8d2784c39b177c845fe26d6e23b73634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 14 Jan 2023 02:09:45 +0000 Subject: [PATCH 04/12] final version for testing --- README.md | 3 +- assets/css/compiled/main.css | 56 +++++++++++++--- assets/css/main.css | 21 +++++- assets/js/header.js | 11 --- config/_default/menus.en.toml | 16 +++++ exampleSite/config/_default/menus.en.toml | 15 +++-- .../content/docs/getting-started/index.md | 35 +++++----- layouts/partials/head.html | 5 -- layouts/partials/header/basic.html | 67 ++++++------------- .../header/header-mobile-option-nested.html | 30 +++++++++ .../header/header-mobile-option-simple.html | 13 ++++ .../partials/header/header-mobile-option.html | 5 ++ .../partials/header/header-option-nested.html | 43 +++++++++++- .../partials/header/header-option-simple.html | 16 +++-- 14 files changed, 227 insertions(+), 109 deletions(-) delete mode 100644 assets/js/header.js create mode 100644 layouts/partials/header/header-mobile-option-nested.html create mode 100644 layouts/partials/header/header-mobile-option-simple.html create mode 100644 layouts/partials/header/header-mobile-option.html diff --git a/README.md b/README.md index 38c7b56e..cbe2449d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,8 @@ Blowfish is designed to be a powerful, lightweight theme for [Hugo](https://gohu - Support for multiple authors - Support for series of articles - Flexible with any content types, taxonomies and menus -- Support for header, footer, and nested menus +- Support for header and footer menus +- Additional support for nested menus - Multilingual content support inlcuding support for RTL languages - Ability to link to posts on third-party websites - Buymeacoffee integration diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 96a66b52..a83eefe4 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -1657,6 +1657,10 @@ select { flex-wrap: wrap; } +.items-end { + align-items: flex-end; +} + .items-center { align-items: center; } @@ -1691,6 +1695,12 @@ select { margin-left: calc(1.25rem * calc(1 - var(--tw-space-x-reverse))); } +.space-y-3 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.75rem * var(--tw-space-y-reverse)); +} + .place-self-center { place-self: center; } @@ -1893,6 +1903,10 @@ select { padding: 0.25rem; } +.p-5 { + padding: 1.25rem; +} + .p-0 { padding: 0px; } @@ -2009,6 +2023,10 @@ select { padding-right: 24px; } +.pt-2 { + padding-top: 0.5rem; +} + .pt-16 { padding-top: 4rem; } @@ -2236,6 +2254,16 @@ select { box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); } +.ring-1 { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.ring-opacity-5 { + --tw-ring-opacity: 0.05; +} + .backdrop-blur { --tw-backdrop-blur: blur(8px); -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); @@ -3013,6 +3041,25 @@ body:has(#menu-controller:checked) { z-index: 100; } +.nested-menu:hover + .menuhide { + visibility: visible; + opacity: 1; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; +} + +.menuhide:hover { + visibility: visible; + opacity: 1; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; +} + +.menuhide { + visibility: hidden; + opacity: 0; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; + z-index: 1000; +} + .first\:mt-8:first-child { margin-top: 2rem; } @@ -3493,20 +3540,11 @@ body:has(#menu-controller:checked) { padding-right: 1.5rem; } - .sm\:py-10 { - padding-top: 2.5rem; - padding-bottom: 2.5rem; - } - .sm\:py-24 { padding-top: 6rem; padding-bottom: 6rem; } - .sm\:pt-10 { - padding-top: 2.5rem; - } - .sm\:pl-6 { padding-left: 1.5rem; } diff --git a/assets/css/main.css b/assets/css/main.css index f23b3095..40a6d8aa 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -420,5 +420,24 @@ body:has(#menu-controller:checked) { } .medium-zoom-image--opened { - z-index: 100; + z-index: 100; +} + +.nested-menu:hover + .menuhide { + visibility: visible; + opacity: 1; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; +} + +.menuhide:hover { + visibility: visible; + opacity: 1; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; +} + +.menuhide { + visibility: hidden; + opacity: 0; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; + z-index: 1000; } \ No newline at end of file diff --git a/assets/js/header.js b/assets/js/header.js deleted file mode 100644 index 1e576c6c..00000000 --- a/assets/js/header.js +++ /dev/null @@ -1,11 +0,0 @@ -function header_toggle_nested_menu(element) { - if (!element) { - throw new Error("Could not find button") - } - let parent_element = element.parentElement; - if(!parent_element) { - throw new Error("Could not get parent element from button") - } - let nested_menu = parent_element.querySelector(".header-nested-menu") - nested_menu.classList.toggle('hidden'); -} diff --git a/config/_default/menus.en.toml b/config/_default/menus.en.toml index 384fc92e..7c25e422 100644 --- a/config/_default/menus.en.toml +++ b/config/_default/menus.en.toml @@ -15,6 +15,22 @@ # pageRef = "posts" # weight = 10 +#[[main]] +# name = "Parent" +# weight = 20 + +#[[main]] +# name = "example sub-menu 1" +# parent = "Parent" +# pageRef = "posts" +# weight = 20 + +#[[main]] +# name = "example sub-menu 2" +# parent = "Parent" +# pageRef = "posts" +# weight = 20 + #[[main]] # name = "Categories" # pageRef = "categories" diff --git a/exampleSite/config/_default/menus.en.toml b/exampleSite/config/_default/menus.en.toml index 4ea8acf8..7b30ce0d 100644 --- a/exampleSite/config/_default/menus.en.toml +++ b/exampleSite/config/_default/menus.en.toml @@ -16,25 +16,26 @@ weight = 10 [[main]] - name = "Parent" + name = "Nested Menu" pageRef = "samples" weight = 20 [[main]] - name = "test1" - parent = "Parent" + name = "sub-menu 1" + parent = "Nested Menu" pageRef = "samples" weight = 20 [[main]] - name = "test2" - parent = "Parent" + name = "sub-menu 2" + parent = "Nested Menu" pageRef = "samples" weight = 20 [[main]] - name = "test3" - parent = "Parent" + name = "sub-menu 3" + parent = "Nested Menu" + pre = "github" pageRef = "samples" weight = 20 diff --git a/exampleSite/content/docs/getting-started/index.md b/exampleSite/content/docs/getting-started/index.md index 3f6aaedf..76f60aa8 100644 --- a/exampleSite/content/docs/getting-started/index.md +++ b/exampleSite/content/docs/getting-started/index.md @@ -197,36 +197,33 @@ Both menus are completely optional and can be commented out if not required. Use ### Nested Menus -bla bla bla +The theme also supports nested menus. In order to use them you just need to define a parent entry in `menu.toml` and its sub-menus using the `parent` parameter to reference the parent. All properties can be used for sub-menus. Note that `pageRef` and `url` will be ignored for the parent entry. Nested menus is only available in the main menu not for the footer. ```toml # config/_default/menus.toml [[main]] - name = "Blog" - pageRef = "posts" - weight = 10 - -[[main]] - name = "Topics" - pageRef = "topics" + name = "Parent" weight = 20 [[main]] - pre = "github" - name = "GitHub" - url = "https://github.com/nunocoracao/blowfish" - weight = 30 + name = "sub-menu 1" + parent = "Parent" + pageRef = "samples" + weight = 20 [[main]] - identifier = "github2" - pre = "github" - url = "https://github.com/nunocoracao/blowfish" - weight = 40 + name = "sub-menu 2" + parent = "Parent" + pageRef = "samples" + weight = 20 -[[footer]] - name = "Privacy" - url = "https://external-link" +[[main]] + name = "sub-menu 3" + parent = "Parent" + pre = "github" + pageRef = "samples" + weight = 20 ``` ## Thumbnails & Backgrounds diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 839b554b..8005f8c9 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -86,11 +86,6 @@ {{ end }} - {{/* Header */}} - {{ $headerLib := resources.Get "js/header.js" }} - {{ $headerLib := $headerLib | resources.Minify }} - {{ $headerJS := $headerLib | resources.Fingerprint "sha512" }} - {{/* Site Verification */}} {{ with .Site.Params.verification.google }} diff --git a/layouts/partials/header/basic.html b/layouts/partials/header/basic.html index 4f5de3bc..1ae3afe4 100644 --- a/layouts/partials/header/basic.html +++ b/layouts/partials/header/basic.html @@ -17,30 +17,30 @@
+
@@ -65,7 +65,7 @@ {{ if .Site.Params.enableSearch | default false }} {{ end }} @@ -94,38 +94,21 @@
-
- -{{ if .Site.Menus.subnavigation }} -
-
- -
-
-{{ end }} +
\ No newline at end of file diff --git a/layouts/partials/header/header-mobile-option-nested.html b/layouts/partials/header/header-mobile-option-nested.html new file mode 100644 index 00000000..94edcc8a --- /dev/null +++ b/layouts/partials/header/header-mobile-option-nested.html @@ -0,0 +1,30 @@ +
  • + + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} +

    + {{ .Name | markdownify | emojify }} +

    + + {{ partial "icon.html" "chevron-down" }} + +
    +
  • +{{ range .Children }} +
  • + + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} +

    + {{ .Name | markdownify | emojify }} +

    +
    +
  • +{{ end }} \ No newline at end of file diff --git a/layouts/partials/header/header-mobile-option-simple.html b/layouts/partials/header/header-mobile-option-simple.html new file mode 100644 index 00000000..7ef286b7 --- /dev/null +++ b/layouts/partials/header/header-mobile-option-simple.html @@ -0,0 +1,13 @@ +
  • + + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} +

    + {{ .Name | markdownify | emojify }} +

    +
    +
  • \ No newline at end of file diff --git a/layouts/partials/header/header-mobile-option.html b/layouts/partials/header/header-mobile-option.html new file mode 100644 index 00000000..17031197 --- /dev/null +++ b/layouts/partials/header/header-mobile-option.html @@ -0,0 +1,5 @@ +{{ if .HasChildren }} + {{ partial "header/header-mobile-option-nested.html" . }} +{{ else }} + {{ partial "header/header-mobile-option-simple.html" . }} +{{ end }} diff --git a/layouts/partials/header/header-option-nested.html b/layouts/partials/header/header-option-nested.html index 87394963..d18f122c 100644 --- a/layouts/partials/header/header-option-nested.html +++ b/layouts/partials/header/header-option-nested.html @@ -1,8 +1,45 @@ -
    +
    +
    + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} + + {{ .Name | markdownify | emojify }} + + + {{ partial "icon.html" "chevron-down" }} + +
    + +
    + + + + \ No newline at end of file diff --git a/layouts/partials/header/header-option-simple.html b/layouts/partials/header/header-option-simple.html index fa36ac68..27865389 100644 --- a/layouts/partials/header/header-option-simple.html +++ b/layouts/partials/header/header-option-simple.html @@ -1,5 +1,11 @@ - - {{ partial "icon.html" .Pre }} - {{ if and .Pre .Name }}   {{ end }} - {{ .Name | markdownify | emojify }} - + + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} +

    + {{ .Name | markdownify | emojify }} +

    +
    \ No newline at end of file From 620368b093415b2cc1c271f45fa444fb29771e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 14 Jan 2023 10:51:32 +0000 Subject: [PATCH 05/12] removed comments --- .../partials/header/header-option-nested.html | 37 +------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/layouts/partials/header/header-option-nested.html b/layouts/partials/header/header-option-nested.html index d18f122c..0c83fb61 100644 --- a/layouts/partials/header/header-option-nested.html +++ b/layouts/partials/header/header-option-nested.html @@ -31,39 +31,4 @@
    - - - - - \ No newline at end of file + \ No newline at end of file From 868c45f3b1f3c8364d6bbdecc550780061837103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 14 Jan 2023 11:11:38 +0000 Subject: [PATCH 06/12] Delete README.md --- layouts/partials/header/README.md | 37 ------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 layouts/partials/header/README.md diff --git a/layouts/partials/header/README.md b/layouts/partials/header/README.md deleted file mode 100644 index e7845957..00000000 --- a/layouts/partials/header/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Header - -- `header-option-simple.html` renders menus without nested items -- `header-option-nested.html` renders menus with nested items -- `header-option.html` decides which template to render given the menu - -- `js/header.js` exposes a method to toggle visibility of nested menus - -- Nesting is configured using the `parent` and `identifier` properties in `menus.en.yml`. Example - -```yml -main: - - name: Product - identifier: product - weight: 1 - - name: Analytics - pageRef: analytics - weight: 1 - parent: product - - name: Engagement - pageRef: engagement - weight: 2 - parent: product - -secondary: - - name: Engineering - identifier: engineering - weight: 1 - - name: Computers - pageRef: computers - weight: 1 - parent: engineering - - name: Rockets - pageRef: rockets - weight: 2 - parent: engineering -``` From 2db7f50c7cc659a3b1615b8eb121116cec16a346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 14 Jan 2023 11:15:07 +0000 Subject: [PATCH 07/12] removed unused css classes --- layouts/partials/header/basic.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/layouts/partials/header/basic.html b/layouts/partials/header/basic.html index 1ae3afe4..551351f3 100644 --- a/layouts/partials/header/basic.html +++ b/layouts/partials/header/basic.html @@ -15,7 +15,7 @@ {{ end }} {{- end }}
    -
    - \ No newline at end of file + + +{{ if .Site.Menus.subnavigation }} + +{{ end }} \ No newline at end of file diff --git a/layouts/partials/header/header-mobile-option-nested.html b/layouts/partials/header/header-mobile-option-nested.html index 94edcc8a..76cefe31 100644 --- a/layouts/partials/header/header-mobile-option-nested.html +++ b/layouts/partials/header/header-mobile-option-nested.html @@ -1,11 +1,11 @@
  • {{ if .Pre }} - + {{ partial "icon.html" .Pre }} {{ end }} -

    +

    {{ .Name | markdownify | emojify }}

    @@ -18,7 +18,7 @@
    {{ if .Pre }} - + {{ partial "icon.html" .Pre }} {{ end }} diff --git a/layouts/partials/header/header-mobile-option-simple.html b/layouts/partials/header/header-mobile-option-simple.html index 7ef286b7..83299063 100644 --- a/layouts/partials/header/header-mobile-option-simple.html +++ b/layouts/partials/header/header-mobile-option-simple.html @@ -2,11 +2,11 @@ {{ if .Pre }} - + {{ partial "icon.html" .Pre }} {{ end }} -

    +

    {{ .Name | markdownify | emojify }}

    diff --git a/layouts/partials/header/header-option-nested.html b/layouts/partials/header/header-option-nested.html index 0c83fb61..1cc761b4 100644 --- a/layouts/partials/header/header-option-nested.html +++ b/layouts/partials/header/header-option-nested.html @@ -1,7 +1,7 @@
    {{ if .Pre }} - + {{ partial "icon.html" .Pre }} {{ end }} @@ -19,7 +19,7 @@ {{ if .Pre }} - + {{ partial "icon.html" .Pre }} {{ end }} diff --git a/layouts/partials/header/header-option-simple.html b/layouts/partials/header/header-option-simple.html index 27865389..d4174601 100644 --- a/layouts/partials/header/header-option-simple.html +++ b/layouts/partials/header/header-option-simple.html @@ -1,7 +1,7 @@ {{ if .Pre }} - + {{ partial "icon.html" .Pre }} {{ end }} From 3cf07f93575c2662b50c7c2985f0048764128763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 14 Jan 2023 13:13:42 +0000 Subject: [PATCH 09/12] readme update --- README.md | 3 ++- config/_default/menus.en.toml | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cbe2449d..8772a8f9 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ Blowfish is designed to be a powerful, lightweight theme for [Hugo](https://gohu - Support for series of articles - Flexible with any content types, taxonomies and menus - Support for header and footer menus -- Additional support for nested menus +- Support for nested menus +- Support for sub-navigation menu - Multilingual content support inlcuding support for RTL languages - Ability to link to posts on third-party websites - Buymeacoffee integration diff --git a/config/_default/menus.en.toml b/config/_default/menus.en.toml index 7c25e422..579cedda 100644 --- a/config/_default/menus.en.toml +++ b/config/_default/menus.en.toml @@ -31,6 +31,17 @@ # pageRef = "posts" # weight = 20 +#[[subnavigation]] +# name = "An interesting topic" +# pageRef = "tags/interesting-topic" +# weight = 10 + +#[[subnavigation]] +# name = "My Awesome Category" +# pre = "github" +# pageRef = "categories/awesome" +# weight = 20 + #[[main]] # name = "Categories" # pageRef = "categories" From 7a9d2b6aa06903c5d436cc3d9c5e9f4b242aded8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 14 Jan 2023 20:06:33 +0000 Subject: [PATCH 10/12] moved images --- {assets => exampleSite/assets}/img/author2.png | Bin {assets => exampleSite/assets}/img/nuno_avatar.jpg | Bin 2 files changed, 0 insertions(+), 0 deletions(-) rename {assets => exampleSite/assets}/img/author2.png (100%) rename {assets => exampleSite/assets}/img/nuno_avatar.jpg (100%) diff --git a/assets/img/author2.png b/exampleSite/assets/img/author2.png similarity index 100% rename from assets/img/author2.png rename to exampleSite/assets/img/author2.png diff --git a/assets/img/nuno_avatar.jpg b/exampleSite/assets/img/nuno_avatar.jpg similarity index 100% rename from assets/img/nuno_avatar.jpg rename to exampleSite/assets/img/nuno_avatar.jpg From 88b23d57de1cda77755e2624903874eeea5d603c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 14 Jan 2023 20:10:37 +0000 Subject: [PATCH 11/12] add dynamic negative margin when logo is used --- layouts/partials/header/basic.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/header/basic.html b/layouts/partials/header/basic.html index ce73be67..2169e190 100644 --- a/layouts/partials/header/basic.html +++ b/layouts/partials/header/basic.html @@ -1,6 +1,6 @@
    - {{ if .Site.Params.Logo -}} + {{ if .Site.Params.Logo }} {{ $logo := resources.Get .Site.Params.Logo }} {{ if $logo }}
    @@ -145,7 +145,7 @@
    {{ if .Site.Menus.subnavigation }} -
    +