Compare commits

...

22 Commits

Author SHA1 Message Date
Nuno Coração a387038958 Merge pull request #721 from nunocoracao/dev
🔖 release v2.33.2
2023-05-12 14:33:16 +01:00
Nuno Coração 08d28ec1c1 updated version 2023-05-12 14:26:50 +01:00
Nuno Coração 914352f71c updated nested menus docs 2023-05-12 14:24:21 +01:00
Nuno Coração 8ca246ce31 Merge pull request #689 from schachem/main
 Fix missing URL for Top-level menu entry in nested menu
2023-05-12 14:18:33 +01:00
Nuno Coração 485b08193c added config secondaryLogo comment to example site 2023-05-12 14:17:38 +01:00
Nuno Coração 50e4c2b9aa Merge pull request #683 from DanWiseProgramming/feature/add_logo_dark_light_mode_switching
[#676] Add logo dark/light mode switching mechanism
2023-05-12 14:13:14 +01:00
Nuno Coração 34ca5acc8f Merge pull request #720 from nunocoracao/690-front-matter-description-is-not-used-for-metadata-but-summary
 frontmatter uses both summary and description
2023-05-12 14:11:40 +01:00
Nuno Coração 7c2ca7969e frontmatter uses both summary and description for site's meta description 2023-05-12 14:10:41 +01:00
Nuno Coração 00704d369a Merge pull request #717 from nunocoracao/dependabot/npm_and_yarn/dev/heroicons/react-2.0.18
📌 Bump @heroicons/react from 2.0.17 to 2.0.18
2023-05-12 14:02:55 +01:00
Nuno Coração 1aa41fae0f Merge pull request #719 from nunocoracao/dependabot/npm_and_yarn/dev/jquery-3.7.0
📌 Bump jquery from 3.6.4 to 3.7.0
2023-05-12 14:02:43 +01:00
dependabot[bot] 99c5fa5a00 📌 Bump jquery from 3.6.4 to 3.7.0
Bumps [jquery](https://github.com/jquery/jquery) from 3.6.4 to 3.7.0.
- [Release notes](https://github.com/jquery/jquery/releases)
- [Commits](https://github.com/jquery/jquery/compare/3.6.4...3.7.0)

---
updated-dependencies:
- dependency-name: jquery
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-12 06:01:22 +00:00
dependabot[bot] 96529363cd 📌 Bump @heroicons/react from 2.0.17 to 2.0.18
Bumps [@heroicons/react](https://github.com/tailwindlabs/heroicons) from 2.0.17 to 2.0.18.
- [Release notes](https://github.com/tailwindlabs/heroicons/releases)
- [Changelog](https://github.com/tailwindlabs/heroicons/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/heroicons/compare/v2.0.17...v2.0.18)

---
updated-dependencies:
- dependency-name: "@heroicons/react"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-10 06:01:44 +00:00
Daniel Odrinski cd946b93e5 Merge branch 'dev' into feature/add_logo_dark_light_mode_switching 2023-05-09 14:12:59 +01:00
Daniel Odrinski a660482b24 ♻️ [#676] Further optimise appearance.js to reduce code duplication 2023-05-02 21:16:16 +01:00
Daniel Odrinski c6869834ea ️ [#676] Optimise appearance.js for no secondary logo 2023-05-02 20:46:56 +01:00
Daniel Odrinski 0e07a9f265 📝[#676] Update documentation for 'secondaryLogo' parameter 2023-05-02 11:04:13 +01:00
Daniel Odrinski 5c12f7597a Merge branch 'feature/add_logo_dark_light_mode_switching' of github.com:DanWiseProgramming/blowfish into feature/add_logo_dark_light_mode_switching 2023-05-02 03:17:40 +01:00
Daniel Odrinski e3869849bd [#676] Add accidentally un-committed files 2023-05-02 03:17:31 +01:00
Daniel Odrinski b8f23598c8 [#676] Add logo dark/light mode switching mechanism 2023-05-02 03:17:31 +01:00
Daniel Odrinski bf8f63b4a6 [#676] Add accidentally un-committed files 2023-05-01 21:50:54 +01:00
schachem 9e7abf32cf Fix missing URL for Top-level menu entry in nested menue 2023-04-30 14:25:25 +02:00
Daniel Odrinski 25a60fffd1 [#676] Add logo dark/light mode switching mechanism 2023-04-26 18:49:53 +01:00
11 changed files with 61 additions and 33 deletions
+32 -6
View File
@@ -26,16 +26,19 @@ window.addEventListener("DOMContentLoaded", (event) => {
const switcher = document.getElementById("appearance-switcher"); const switcher = document.getElementById("appearance-switcher");
const switcherMobile = document.getElementById("appearance-switcher-mobile"); const switcherMobile = document.getElementById("appearance-switcher-mobile");
updateMeta() updateMeta();
this.updateLogo?.(getTargetAppearance());
if (switcher) { if (switcher) {
switcher.addEventListener("click", () => { switcher.addEventListener("click", () => {
document.documentElement.classList.toggle("dark"); document.documentElement.classList.toggle("dark");
var targetAppearance = getTargetAppearance();
localStorage.setItem( localStorage.setItem(
"appearance", "appearance",
document.documentElement.classList.contains("dark") ? "dark" : "light" targetAppearance
); );
updateMeta() updateMeta();
this.updateLogo?.(targetAppearance);
}); });
switcher.addEventListener("contextmenu", (event) => { switcher.addEventListener("contextmenu", (event) => {
event.preventDefault(); event.preventDefault();
@@ -45,11 +48,13 @@ window.addEventListener("DOMContentLoaded", (event) => {
if (switcherMobile) { if (switcherMobile) {
switcherMobile.addEventListener("click", () => { switcherMobile.addEventListener("click", () => {
document.documentElement.classList.toggle("dark"); document.documentElement.classList.toggle("dark");
var targetAppearance = getTargetAppearance();
localStorage.setItem( localStorage.setItem(
"appearance", "appearance",
document.documentElement.classList.contains("dark") ? "dark" : "light" targetAppearance
); );
updateMeta() updateMeta();
this.updateLogo?.(targetAppearance);
}); });
switcherMobile.addEventListener("contextmenu", (event) => { switcherMobile.addEventListener("contextmenu", (event) => {
event.preventDefault(); event.preventDefault();
@@ -66,10 +71,31 @@ var updateMeta = () => {
document.querySelector('meta[name="theme-color"]').setAttribute('content', style.backgroundColor); document.querySelector('meta[name="theme-color"]').setAttribute('content', style.backgroundColor);
} }
{{ if and (.Site.Params.Logo) (.Site.Params.SecondaryLogo) }}
{{ $primaryLogo := resources.Get .Site.Params.Logo }}
{{ $secondaryLogo := resources.Get .Site.Params.SecondaryLogo }}
{{ if and ($primaryLogo) ($secondaryLogo) }}
var updateLogo = (targetAppearance) => {
var elems;
elems = document.querySelectorAll("img.logo")
targetLogoPath =
targetAppearance == "{{ .Site.Params.DefaultAppearance }}" ?
"{{ $primaryLogo.RelPermalink }}" : "{{ $secondaryLogo.RelPermalink }}"
for (const elem of elems) {
elem.setAttribute("src", targetLogoPath)
}
}
{{ end }}
{{- end }}
var getTargetAppearance = () => {
return document.documentElement.classList.contains("dark") ? "dark" : "light"
}
window.addEventListener("DOMContentLoaded", (event) => { window.addEventListener("DOMContentLoaded", (event) => {
const scroller = document.getElementById("top-scroller"); const scroller = document.getElementById("top-scroller");
const footer = document.getElementById("site-footer"); const footer = document.getElementById("site-footer");
if(scroller.getBoundingClientRect().top > footer.getBoundingClientRect().top) { if(scroller.getBoundingClientRect().top > footer.getBoundingClientRect().top) {
scroller.hidden = true; scroller.hidden = true;
} }
}); });
+1
View File
@@ -7,6 +7,7 @@ rtl = false
title = "Blowfish" title = "Blowfish"
# logo = "img/logo.png" # logo = "img/logo.png"
# secondaryLogo = "img/secondary-logo.png"
# description = "My awesome website" # description = "My awesome website"
# copyright = "Copy, _right?_ :thinking_face:" # copyright = "Copy, _right?_ :thinking_face:"
@@ -7,6 +7,7 @@ rtl = false
title = "Blowfish" title = "Blowfish"
logo = "img/blowfish_logo_transparent.png" logo = "img/blowfish_logo_transparent.png"
#secondaryLogo = "PATH"
description = "A powerful, lightweight theme for Hugo built with Tailwind CSS." description = "A powerful, lightweight theme for Hugo built with Tailwind CSS."
# copyright = "Copy, _right?_ :thinking_face:" # copyright = "Copy, _right?_ :thinking_face:"
@@ -19,8 +19,6 @@
# name = "Examples" # name = "Examples"
# weight = 20 # weight = 20
[[main]] [[main]]
name = "Samples" name = "Samples"
pageRef = "samples" pageRef = "samples"
@@ -141,6 +141,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
| `enableSearch` | `false` | Whether site search is enabled. Set to `true` to enable search functionality. Note that the search feature depends on the `outputs.home` setting in the [site configuration](#site-configuration) being set correctly. | | `enableSearch` | `false` | Whether site search is enabled. Set to `true` to enable search functionality. Note that the search feature depends on the `outputs.home` setting in the [site configuration](#site-configuration) being set correctly. |
| `enableCodeCopy` | `false` | Whether copy-to-clipboard buttons are enabled for `<code>` blocks. The `highlight.noClasses` parameter must be set to `false` for code copy to function correctly. Read more about [other configuration files](#other-configuration-files) below. | | `enableCodeCopy` | `false` | Whether copy-to-clipboard buttons are enabled for `<code>` blocks. The `highlight.noClasses` parameter must be set to `false` for code copy to function correctly. Read more about [other configuration files](#other-configuration-files) below. |
| `logo` | _Not set_ | The relative path to the site logo file within the `assets/` folder. The logo file should be provided at 2x resolution and supports any image dimensions. | | `logo` | _Not set_ | The relative path to the site logo file within the `assets/` folder. The logo file should be provided at 2x resolution and supports any image dimensions. |
| `secondaryLogo` | _Not set_ | The relative path to the secondary site logo file within the `assets/` folder. The logo file should be provided at 2x resolution and supports any image dimensions. This should have an inverted/contrasting colour scheme to `logo`. If set, this logo will be shown when users toggle from the `defaultAppearance` mode. |
| `mainSections` | _Not set_ | The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used. | | `mainSections` | _Not set_ | The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used. |
| `showViews` | _Not set_ | Whether or not articles and list views are displayed. This requires firebase integrations to be enabled, look below. | | `showViews` | _Not set_ | Whether or not articles and list views are displayed. This requires firebase integrations to be enabled, look below. |
| `showLikes` | _Not set_ | Whether or not articles and list likes are displayed. This requires firebase integrations to be enabled, look below. | | `showLikes` | _Not set_ | Whether or not articles and list likes are displayed. This requires firebase integrations to be enabled, look below. |
@@ -197,7 +197,7 @@ Both menus are completely optional and can be commented out if not required. Use
### Nested menus ### 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. 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. `pageRef` and `url` can also be used in the parent entry. Nested menus are only available in the main menu not for the footer.
```toml ```toml
# config/_default/menus.toml # config/_default/menus.toml
+2 -2
View File
@@ -14,7 +14,7 @@
<meta name="title" content="{{ .Title | emojify }} &middot; {{ .Site.Title | emojify }}" /> <meta name="title" content="{{ .Title | emojify }} &middot; {{ .Site.Title | emojify }}" />
{{- end }} {{- end }}
{{/* Metadata */}} {{/* Metadata */}}
{{ with .Params.Summary | default .Site.Params.description -}} {{ with (.Params.Summary | default .Params.Description) | default .Site.Params.description -}}
<meta name="description" content="{{ . }}" /> <meta name="description" content="{{ . }}" />
{{- end }} {{- end }}
{{ with .Params.Tags | default .Site.Params.keywords -}} {{ with .Params.Tags | default .Site.Params.keywords -}}
@@ -50,7 +50,7 @@
<link type="text/css" rel="stylesheet" href="{{ $bundleCSS.RelPermalink }}" <link type="text/css" rel="stylesheet" href="{{ $bundleCSS.RelPermalink }}"
integrity="{{ $bundleCSS.Data.Integrity }}" /> integrity="{{ $bundleCSS.Data.Integrity }}" />
{{ $jsAppearance := resources.Get "js/appearance.js" }} {{ $jsAppearance := resources.Get "js/appearance.js" }}
{{ $jsAppearance = $jsAppearance | resources.Minify | resources.Fingerprint "sha512" }} {{ $jsAppearance = $jsAppearance | resources.ExecuteAsTemplate $jsAppearance.RelPermalink . | resources.Minify | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $jsAppearance.RelPermalink }}" <script type="text/javascript" src="{{ $jsAppearance.RelPermalink }}"
integrity="{{ $jsAppearance.Data.Integrity }}"></script> integrity="{{ $jsAppearance.Data.Integrity }}"></script>
{{ if .Site.Params.enableSearch | default false }} {{ if .Site.Params.enableSearch | default false }}
+1 -1
View File
@@ -8,7 +8,7 @@
<span class="sr-only">{{ .Site.Title | markdownify | emojify }}</span> <span class="sr-only">{{ .Site.Title | markdownify | emojify }}</span>
<img src="{{ $logo.RelPermalink }}" width="{{ div $logo.Width 2 }}" height="{{ div $logo.Height 2 }}" <img src="{{ $logo.RelPermalink }}" width="{{ div $logo.Width 2 }}" height="{{ div $logo.Height 2 }}"
class="max-h-[5rem] max-w-[5rem] object-scale-down object-left nozoom" alt="{{ .Site.Title }}" /> class="logo max-h-[5rem] max-w-[5rem] object-scale-down object-left nozoom" alt="{{ .Site.Title }}" />
</a> </a>
</div> </div>
@@ -5,7 +5,8 @@
{{ partial "icon.html" .Pre }} {{ partial "icon.html" .Pre }}
</span> </span>
{{ end }} {{ end }}
<a class="text-base font-medium text-gray-500 hover:text-gray-900" title="{{ .Title }}"> <a {{ if .URL }} href="{{ .URL }}" {{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" ) }}
target="_blank" {{ end }} {{ end }} class="text-base font-medium text-gray-500 hover:text-gray-900" title="{{ .Title }}">
{{ .Name | markdownify | emojify }} {{ .Name | markdownify | emojify }}
</a> </a>
<span> <span>
@@ -31,4 +32,4 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
+16 -16
View File
@@ -1,17 +1,17 @@
{ {
"name": "hugo-blowfish-theme", "name": "hugo-blowfish-theme",
"version": "2.33.0", "version": "2.33.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "hugo-blowfish-theme", "name": "hugo-blowfish-theme",
"version": "2.33.0", "version": "2.33.1",
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@headlessui/react": "^1.7.14", "@headlessui/react": "^1.7.14",
"@heroicons/react": "^2.0.17", "@heroicons/react": "^2.0.18",
"@tailwindcss/forms": "^0.5.3", "@tailwindcss/forms": "^0.5.3",
"commander": "^10.0.1" "commander": "^10.0.1"
}, },
@@ -19,7 +19,7 @@
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.5.9",
"chart.js": "^4.3.0", "chart.js": "^4.3.0",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"jquery": "^3.6.4", "jquery": "^3.7.0",
"katex": "^0.16.7", "katex": "^0.16.7",
"packery": "^2.1.2", "packery": "^2.1.2",
"prettier": "^2.8.8", "prettier": "^2.8.8",
@@ -59,9 +59,9 @@
} }
}, },
"node_modules/@heroicons/react": { "node_modules/@heroicons/react": {
"version": "2.0.17", "version": "2.0.18",
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.17.tgz", "resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.18.tgz",
"integrity": "sha512-90GMZktkA53YbNzHp6asVEDevUQCMtxWH+2UK2S8OpnLEu7qckTJPhNxNQG52xIR1WFTwFqtH6bt7a60ZNcLLA==", "integrity": "sha512-7TyMjRrZZMBPa+/5Y8lN0iyvUU/01PeMGX2+RE7cQWpEUIcb4QotzUObFkJDejj/HUH4qjP/eQ0gzzKs2f+6Yw==",
"peerDependencies": { "peerDependencies": {
"react": ">= 16" "react": ">= 16"
} }
@@ -594,9 +594,9 @@
} }
}, },
"node_modules/jquery": { "node_modules/jquery": {
"version": "3.6.4", "version": "3.7.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.4.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.0.tgz",
"integrity": "sha512-v28EW9DWDFpzcD9O5iyJXg3R3+q+mET5JhnjJzQUZMHOv67bpSIHq81GEYpPNZHG+XXHsfSme3nxp/hndKEcsQ==", "integrity": "sha512-umpJ0/k8X0MvD1ds0P9SfowREz2LenHsQaxSohMZ5OMNEU2r0tf8pdeEFTHMFxWVxKNyU9rTtK3CWzUCTKJUeQ==",
"dev": true "dev": true
}, },
"node_modules/js-tokens": { "node_modules/js-tokens": {
@@ -1650,9 +1650,9 @@
} }
}, },
"@heroicons/react": { "@heroicons/react": {
"version": "2.0.17", "version": "2.0.18",
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.17.tgz", "resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.18.tgz",
"integrity": "sha512-90GMZktkA53YbNzHp6asVEDevUQCMtxWH+2UK2S8OpnLEu7qckTJPhNxNQG52xIR1WFTwFqtH6bt7a60ZNcLLA==", "integrity": "sha512-7TyMjRrZZMBPa+/5Y8lN0iyvUU/01PeMGX2+RE7cQWpEUIcb4QotzUObFkJDejj/HUH4qjP/eQ0gzzKs2f+6Yw==",
"requires": {} "requires": {}
}, },
"@jridgewell/gen-mapping": { "@jridgewell/gen-mapping": {
@@ -2069,9 +2069,9 @@
"integrity": "sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg==" "integrity": "sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg=="
}, },
"jquery": { "jquery": {
"version": "3.6.4", "version": "3.7.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.4.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.0.tgz",
"integrity": "sha512-v28EW9DWDFpzcD9O5iyJXg3R3+q+mET5JhnjJzQUZMHOv67bpSIHq81GEYpPNZHG+XXHsfSme3nxp/hndKEcsQ==", "integrity": "sha512-umpJ0/k8X0MvD1ds0P9SfowREz2LenHsQaxSohMZ5OMNEU2r0tf8pdeEFTHMFxWVxKNyU9rTtK3CWzUCTKJUeQ==",
"dev": true "dev": true
}, },
"js-tokens": { "js-tokens": {
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "hugo-blowfish-theme", "name": "hugo-blowfish-theme",
"version": "2.33.1", "version": "2.33.2",
"description": "Blowfish theme for Hugo", "description": "Blowfish theme for Hugo",
"scripts": { "scripts": {
"fullinstall": "npm run preinstall && npm install && npm run postinstall", "fullinstall": "npm run preinstall && npm install && npm run postinstall",
@@ -37,7 +37,7 @@
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.5.9",
"chart.js": "^4.3.0", "chart.js": "^4.3.0",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"jquery": "^3.6.4", "jquery": "^3.7.0",
"katex": "^0.16.7", "katex": "^0.16.7",
"packery": "^2.1.2", "packery": "^2.1.2",
"prettier": "^2.8.8", "prettier": "^2.8.8",
@@ -94,7 +94,7 @@
], ],
"dependencies": { "dependencies": {
"@headlessui/react": "^1.7.14", "@headlessui/react": "^1.7.14",
"@heroicons/react": "^2.0.17", "@heroicons/react": "^2.0.18",
"@tailwindcss/forms": "^0.5.3", "@tailwindcss/forms": "^0.5.3",
"commander": "^10.0.1" "commander": "^10.0.1"
} }