diff --git a/README.md b/README.md index ac841281..8772a8f9 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,9 @@ 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 and footer 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/assets/css/compiled/main.css b/assets/css/compiled/main.css index 69f13156..45b6330e 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -1433,6 +1433,10 @@ select { margin-right: -0.5rem; } +.mr-1 { + margin-right: 0.25rem; +} + .ml-auto { margin-left: auto; } @@ -1673,6 +1677,10 @@ select { flex-wrap: wrap; } +.items-end { + align-items: flex-end; +} + .items-center { align-items: center; } @@ -1707,6 +1715,18 @@ select { margin-left: calc(1.25rem * calc(1 - var(--tw-space-x-reverse))); } +.space-y-2 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.5rem * var(--tw-space-y-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; } @@ -2021,6 +2041,10 @@ select { padding-left: 0.5rem; } +.pb-3 { + padding-bottom: 0.75rem; +} + .pl-\[24px\] { padding-left: 24px; } @@ -2029,6 +2053,10 @@ select { padding-right: 24px; } +.pt-2 { + padding-top: 0.5rem; +} + .pt-16 { padding-top: 4rem; } @@ -2116,6 +2144,10 @@ select { font-weight: 500; } +.font-light { + font-weight: 300; +} + .uppercase { text-transform: uppercase; } @@ -3033,6 +3065,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; } @@ -3513,20 +3564,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 a8adaa99..40a6d8aa 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -419,7 +419,25 @@ 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/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/config/_default/menus.en.toml b/config/_default/menus.en.toml index 384fc92e..579cedda 100644 --- a/config/_default/menus.en.toml +++ b/config/_default/menus.en.toml @@ -15,6 +15,33 @@ # 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 + +#[[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" 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 diff --git a/exampleSite/content/docs/getting-started/index.md b/exampleSite/content/docs/getting-started/index.md index c66da380..c7835c98 100644 --- a/exampleSite/content/docs/getting-started/index.md +++ b/exampleSite/content/docs/getting-started/index.md @@ -195,6 +195,57 @@ 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 + +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 = "Parent" + weight = 20 + +[[main]] + name = "sub-menu 1" + parent = "Parent" + pageRef = "samples" + weight = 20 + +[[main]] + name = "sub-menu 2" + parent = "Parent" + pageRef = "samples" + weight = 20 + +[[main]] + name = "sub-menu 3" + parent = "Parent" + pre = "github" + pageRef = "samples" + weight = 20 +``` + +### Sub-Navigation menu + +Additionally, you can also configure a sub-navigation menu. Just define new menu entries as `subnavigation` in `menu.toml`. This will render a second line with caregories below the main header menu. + +```toml +# config/_default/menus.toml + +[[subnavigation]] + name = "An interesting topic" + pageRef = "tags/interesting-topic" + weight = 10 + +[[subnavigation]] + name = "My Awesome Category" + pageRef = "categories/awesome" + weight = 20 +``` + + + ## 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. @@ -205,4 +256,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 31db44bf..8005f8c9 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -147,4 +147,4 @@ {{ end }} {{ end }} - \ No newline at end of file + diff --git a/layouts/partials/header/basic.html b/layouts/partials/header/basic.html index 68678db5..e3237613 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 }}
@@ -17,20 +17,17 @@
- + +{{ 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..9f21bb5d --- /dev/null +++ b/layouts/partials/header/header-mobile-option-nested.html @@ -0,0 +1,31 @@ +
  • + + {{ 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..acc4cdf1 --- /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 new file mode 100644 index 00000000..1cc761b4 --- /dev/null +++ b/layouts/partials/header/header-option-nested.html @@ -0,0 +1,34 @@ +
    +
    + {{ 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 new file mode 100644 index 00000000..d4174601 --- /dev/null +++ b/layouts/partials/header/header-option-simple.html @@ -0,0 +1,11 @@ + + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} +

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

    +
    \ No newline at end of file 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 }}