Merge pull request #239 from nunocoracao/236-buymeacoffee-integration

Integration with buymeacoffee
This commit is contained in:
Nuno Coração 2022-11-13 19:40:13 +00:00 committed by GitHub
commit 59e5daa31f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 142 additions and 132 deletions

View file

@ -35,6 +35,7 @@ Blowfish is designed to be a powerful, lightweight theme for [Hugo](https://gohu
- Flexible with any content types, taxonomies and menus - Flexible with any content types, taxonomies and menus
- Multilingual content support inlcuding support for RTL languages - Multilingual content support inlcuding support for RTL languages
- Ability to link to posts on third-party websites - Ability to link to posts on third-party websites
- Buymeacoffee integration
- Client-side site search powered by Fuse.js - Client-side site search powered by Fuse.js
- Diagrams and visualisations using Mermaid - Diagrams and visualisations using Mermaid
- Charts using Chart.js - Charts using Chart.js

View file

@ -94,6 +94,13 @@ enableCodeCopy = true
# site = "ABC12345" # site = "ABC12345"
# domain = "llama.yoursite.com" # domain = "llama.yoursite.com"
[buymeacoffee]
# identifier = ""
# globalWidget = true
# globalWidgetMessage = "Hello"
# globalWidgetColor = "#FFDD00"
# globalWidgetPosition = "Right"
[verification] [verification]
# google = "" # google = ""
# bing = "" # bing = ""

View file

@ -94,6 +94,13 @@ mainSections = ["docs"]
# site = "ABC12345" # site = "ABC12345"
# domain = "llama.yoursite.com" # domain = "llama.yoursite.com"
[buymeacoffee]
identifier = "nunocoracao"
globalWidget = true
globalWidgetMessage = "Thank you for visiting."
globalWidgetColor = "#FFDD00"
globalWidgetPosition = "Right"
[verification] [verification]
# google = "" # google = ""
# bing = "" # bing = ""

View file

@ -125,7 +125,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
| Name | Default | Description | | Name | Default | Description |
| ------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ----------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `colorScheme` | `"blowfish"` | The theme colour scheme to use. Valid values are `blowfish` (default), `avocado`, `ocean`, `fire` and `slate`. Refer to the [Colour Schemes]({{< ref "getting-started#colour-schemes" >}}) section for more details. | | `colorScheme` | `"blowfish"` | The theme colour scheme to use. Valid values are `blowfish` (default), `avocado`, `ocean`, `fire` and `slate`. Refer to the [Colour Schemes]({{< ref "getting-started#colour-schemes" >}}) section for more details. |
| `defaultAppearance` | `"light"` | The default theme appearance, either `light` or `dark`. | | `defaultAppearance` | `"light"` | The default theme appearance, either `light` or `dark`. |
| `autoSwitchAppearance` | `true` | Whether the theme appearance automatically switches based upon the visitor's operating system preference. Set to `false` to force the site to always use the `defaultAppearance`. | | `autoSwitchAppearance` | `true` | Whether the theme appearance automatically switches based upon the visitor's operating system preference. Set to `false` to force the site to always use the `defaultAppearance`. |
@ -189,15 +189,20 @@ Many of the article defaults here can be overridden on a per article basis by sp
| `list.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. | | `list.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. |
| `sitemap.excludedKinds` | `["taxonomy", "term"]` | Kinds of content that should be excluded from the generated `/sitemap.xml` file. Refer to the [Hugo docs](https://gohugo.io/templates/section-templates/#page-kinds) for acceptable values. | | `sitemap.excludedKinds` | `["taxonomy", "term"]` | Kinds of content that should be excluded from the generated `/sitemap.xml` file. Refer to the [Hugo docs](https://gohugo.io/templates/section-templates/#page-kinds) for acceptable values. |
| `taxonomy.showTermCount` | `true` | Whether or not the number of articles within a taxonomy term is displayed on the taxonomy listing. | | `taxonomy.showTermCount` | `true` | Whether or not the number of articles within a taxonomy term is displayed on the taxonomy listing. |
| `firebase.apiKey` | _Not set_ | Firebase apiKey, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish | | `firebase.apiKey` | _Not set_ | Firebase apiKey, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish. |
| `firebase.authDomain` | _Not set_ | Firebase authDomain, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish | | `firebase.authDomain` | _Not set_ | Firebase authDomain, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish. |
| `firebase.projectId` | _Not set_ | Firebase projectId, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish | | `firebase.projectId` | _Not set_ | Firebase projectId, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish. |
| `firebase.storageBucket` | _Not set_ | Firebase storageBucket, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish | | `firebase.storageBucket` | _Not set_ | Firebase storageBucket, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish. |
| `firebase.messagingSenderId` | _Not set_ | Firebase messagingSenderId, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish | | `firebase.messagingSenderId` | _Not set_ | Firebase messagingSenderId, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish. |
| `firebase.appId` | _Not set_ | Firebase appId, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish | | `firebase.appId` | _Not set_ | Firebase appId, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish. |
| `firebase.measurementId` | _Not set_ | Firebase measurementId, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish | | `firebase.measurementId` | _Not set_ | Firebase measurementId, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish. |
| `fathomAnalytics.site` | _Not set_ | The site code generated by Fathom Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. | | `fathomAnalytics.site` | _Not set_ | The site code generated by Fathom Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. |
| `fathomAnalytics.domain` | _Not set_ | If using a custom domain with Fathom Analytics, provide it here to serve `script.js` from the custom domain. | | `fathomAnalytics.domain` | _Not set_ | If using a custom domain with Fathom Analytics, provide it here to serve `script.js` from the custom domain. |
| `buymeacoffee.identifier` | _Not set_ | The identifier to the target buymeacoffee account. |
| `buymeacoffee.globalWidget` | _Not set_ | Activate the global buymeacoffee widget. |
| `buymeacoffee.globalWidgetMessage` | _Not set_ | Message what will be displayed the first time a new user lands on the site. |
| `buymeacoffee.globalWidgetColor` | _Not set_ | Widget color in hex format. |
| `buymeacoffee.globalWidgetPosition` | _Not set_ | Position of the widget, i.e. "Left" or "Right" |
| `verification.google` | _Not set_ | The site verification string provided by Google to be included in the site metadata. | | `verification.google` | _Not set_ | The site verification string provided by Google to be included in the site metadata. |
| `verification.bing` | _Not set_ | The site verification string provided by Bing to be included in the site metadata. | | `verification.bing` | _Not set_ | The site verification string provided by Bing to be included in the site metadata. |
| `verification.pinterest` | _Not set_ | The site verification string provided by Pinterest to be included in the site metadata. | | `verification.pinterest` | _Not set_ | The site verification string provided by Pinterest to be included in the site metadata. |

View file

@ -1,30 +1,20 @@
{{- partial "partials/functions/warnings.html" .Site -}} {{- partial "partials/functions/warnings.html" .Site -}}
<!DOCTYPE html> <!DOCTYPE html>
<html <html lang="{{ with .Site.Params.isoCode | default (.Site.LanguageCode | default " en") }} {{- . -}} {{ end }}" dir="{{ if .Site.Params.rtl | default false -}}
lang="{{ with .Site.Params.isoCode | default (.Site.LanguageCode | default "en") }}
{{- . -}}
{{ end }}"
dir="{{ if .Site.Params.rtl | default false -}}
rtl rtl
{{- else -}} {{- else -}}
ltr ltr
{{- end }}" {{- end }}" class="scroll-smooth" data-default-appearance="{{ .Site.Params.defaultAppearance | default " light" }}"
class="scroll-smooth" data-auto-appearance="{{ .Site.Params.autoSwitchAppearance | default " true" }}">
data-default-appearance="{{ .Site.Params.defaultAppearance | default "light" }}" {{- partial "head.html" . -}}
data-auto-appearance="{{ .Site.Params.autoSwitchAppearance | default "true" }}"
> <body
{{- partial "head.html" . -}} class="flex flex-col h-screen px-6 m-auto text-lg leading-7 max-w-7xl bg-neutral text-neutral-900 dark:bg-neutral-800 dark:text-neutral sm:px-14 md:px-24 lg:px-32">
<body
class="flex flex-col h-screen px-6 m-auto text-lg leading-7 max-w-7xl bg-neutral text-neutral-900 dark:bg-neutral-800 dark:text-neutral sm:px-14 md:px-24 lg:px-32"
>
<div id="the-top" class="absolute flex self-center"> <div id="the-top" class="absolute flex self-center">
<a <a class="px-3 py-1 text-sm -translate-y-8 rounded-b-lg bg-primary-200 focus:translate-y-0 dark:bg-neutral-600"
class="px-3 py-1 text-sm -translate-y-8 rounded-b-lg bg-primary-200 focus:translate-y-0 dark:bg-neutral-600" href="#main-content"><span
href="#main-content" class="font-bold text-primary-600 ltr:pr-2 rtl:pl-2 dark:text-primary-400">&darr;</span>{{ i18n
><span class="font-bold text-primary-600 ltr:pr-2 rtl:pl-2 dark:text-primary-400" "nav.skip_to_main" }}</a>
>&darr;</span
>{{ i18n "nav.skip_to_main" }}</a
>
</div> </div>
{{ $header := print "partials/header/" .Site.Params.header.layout ".html" }} {{ $header := print "partials/header/" .Site.Params.header.layout ".html" }}
{{ if templates.Exists $header }} {{ if templates.Exists $header }}
@ -36,15 +26,10 @@
<main id="main-content" class="grow"> <main id="main-content" class="grow">
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
{{ if and (.Site.Params.footer.showScrollToTop | default true) (gt .WordCount 200) }} {{ if and (.Site.Params.footer.showScrollToTop | default true) (gt .WordCount 200) }}
<div <div class="pointer-events-none absolute top-[100vh] bottom-0 w-12 ltr:right-0 rtl:left-0">
class="pointer-events-none absolute top-[100vh] bottom-0 w-12 ltr:right-0 rtl:left-0" <a href="#the-top"
>
<a
href="#the-top"
class="pointer-events-auto sticky top-[calc(100vh-5.5rem)] flex h-12 w-12 items-center justify-center rounded-full bg-neutral/50 text-xl text-neutral-700 backdrop-blur hover:text-primary-600 dark:bg-neutral-800/50 dark:text-neutral dark:hover:text-primary-400" class="pointer-events-auto sticky top-[calc(100vh-5.5rem)] flex h-12 w-12 items-center justify-center rounded-full bg-neutral/50 text-xl text-neutral-700 backdrop-blur hover:text-primary-600 dark:bg-neutral-800/50 dark:text-neutral dark:hover:text-primary-400"
aria-label="{{ i18n "nav.scroll_to_top_title" }}" aria-label="{{ i18n " nav.scroll_to_top_title" }}" title="{{ i18n " nav.scroll_to_top_title" }}">
title="{{ i18n "nav.scroll_to_top_title" }}"
>
&uarr; &uarr;
</a> </a>
</div> </div>
@ -55,5 +40,10 @@
{{- partial "search.html" . -}} {{- partial "search.html" . -}}
{{ end }} {{ end }}
</div> </div>
</body> </body>
{{ if .Site.Params.buymeacoffee.globalWidget | default false }}
<script data-name="BMC-Widget" data-cfasync="false" src="https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js"
data-id="{{ .Site.Params.buymeacoffee.identifier }}" data-description="Support me on Buy me a coffee!" data-message="{{ .Site.Params.buymeacoffee.globalWidgetMessage | default "" }}"
data-color="{{ .Site.Params.buymeacoffee.globalWidgetColor | default "#FFDD00" }}" data-position="{{ .Site.Params.buymeacoffee.globalWidgetPosition | default "Left" }}" data-x_margin="18" data-y_margin="18"></script>
{{ end }}
</html> </html>

View file

@ -1,6 +1,6 @@
{ {
"name": "hugo-blowfish-theme", "name": "hugo-blowfish-theme",
"version": "2.11.0", "version": "2.12.0",
"description": "Blowfish theme for Hugo", "description": "Blowfish theme for Hugo",
"scripts": { "scripts": {
"preinstall": "rimraf assets/vendor", "preinstall": "rimraf assets/vendor",