From 924953a0a210af4a79fc806e5966c124702862b2 Mon Sep 17 00:00:00 2001 From: Charles Chin Date: Thu, 24 Oct 2024 18:48:17 +0800 Subject: [PATCH] feat: custom umami script name * https://umami.is/docs/environment-variables#TRACKER_SCRIPT_NAME --- config/_default/params.toml | 1 + exampleSite/config/_default/params.toml | 1 + .../content/docs/configuration/index.it.md | 20 ++++++++++++------- .../content/docs/configuration/index.ja.md | 20 ++++++++++++------- .../content/docs/configuration/index.md | 20 ++++++++++++------- .../content/docs/configuration/index.zh-cn.md | 10 +++++----- exampleSite/content/docs/partials/index.it.md | 8 +++++--- exampleSite/content/docs/partials/index.ja.md | 7 ++++--- exampleSite/content/docs/partials/index.md | 7 ++++--- .../content/docs/partials/index.zh-cn.md | 16 +++++---------- layouts/partials/analytics/umami.html | 2 +- 11 files changed, 65 insertions(+), 47 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index d15943ef9..4399e0eab 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -141,6 +141,7 @@ forgejoDefaultServer = "https://v8.next.forgejo.org" # websiteid = "ABC12345" # domain = "llama.yoursite.com" # dataDomains = "yoursite.com,yoursite2.com" + # scriptName = "" # enableTrackEvent = true [selineAnalytics] diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index fc116a158..c83c1dbe1 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -137,6 +137,7 @@ smartTOCHideUnfocusedChildren = false # websiteid = "ABC12345" # domain = "llama.yoursite.com" # dataDomains = "yoursite.com,yoursite2.com" + # scriptName = "" # enableTrackEvent = false [selineAnalytics] diff --git a/exampleSite/content/docs/configuration/index.it.md b/exampleSite/content/docs/configuration/index.it.md index b4cfcd468..eb84248e4 100644 --- a/exampleSite/content/docs/configuration/index.it.md +++ b/exampleSite/content/docs/configuration/index.it.md @@ -16,9 +16,11 @@ Il tema viene fornito con una configurazione predefinita che ti consente di esse {{< alert "fire" >}} We just launched a CLI tool to help you get started with Blowfish. It will help you with installation and configuration. Install the CLI tool globally using: + ```bash npx blowfish-tools ``` + {{< /alert >}} > I file di configurazione forniti con il tema sono forniti in formato TOML dato che questa è la sintassi predefinita di Hugo. Sentiti libero di convertire la tua configurazione in YAML o JSON se lo desideri. @@ -53,7 +55,7 @@ Tieni presente che i nomi delle variabili forniti in questa tabella utilizzano i ## Thumbnails -Blowfish è stato creato in modo che sia facile aggiungere supporto visivo ai tuoi articoli. Se hai familiarità con la struttura degli articoli di Hugo, devi solo inserire un file immagine (quasi tutti i formati sono supportati ma consigliamo `.png` o `.jpg`) che inizi con `feature*` all'interno della cartella dell'articolo. E questo è tutto, Blowfish sarà quindi in grado di utilizzare l'immagine sia come miniatura all'interno del tuo sito web sia per le schede oEmbed su piattaforme sociali. +Blowfish è stato creato in modo che sia facile aggiungere supporto visivo ai tuoi articoli. Se hai familiarità con la struttura degli articoli di Hugo, devi solo inserire un file immagine (quasi tutti i formati sono supportati ma consigliamo `.png` o `.jpg`) che inizi con `feature*` all'interno della cartella dell'articolo. E questo è tutto, Blowfish sarà quindi in grado di utilizzare l'immagine sia come miniatura all'interno del tuo sito web sia per le schede oEmbed su piattaforme sociali. [Qui]({{< ref "thumbnails" >}}) c'è anche una guida con maggiori informazioni e un [esempio]({{< ref "thumbnail_sample" >}}) se vuoi vedere come puoi farlo. @@ -94,8 +96,6 @@ Il tema attualmente supporta le seguenti lingue per impostazione predefinita: | Simplified Chinese (China) | `zh-cn` | | Traditional Chinese (Taiwan) | `zh-tw` | - - Le traduzioni predefinite possono essere sovrascritte creando un file personalizzato in "i18n/[code].yaml" che contiene le stringhe di traduzione. Puoi anche utilizzare questo metodo per aggiungere nuove lingue. Se desideri condividere una nuova traduzione con la community, [apri una richiesta pull](https://github.com/nunocoracao/blowfish/pulls). ### Configurazione @@ -108,7 +108,6 @@ Il file predefinito può essere utilizzato come modello per creare lingue aggiun **Nota:** assicurati che il parametro `defaultContentLanguage` nella [configurazione del sito](#site-configuration) corrisponda al codice della lingua nel nome del file di configurazione della lingua. {{< /alert >}} - #### Globale @@ -134,10 +133,10 @@ Il file predefinito può essere utilizzato come modello per creare lingue aggiun | `params.description` | _Not set_ | The website description. This will be used in the site metadata. | | `params.copyright` | _Not set_ | A Markdown string for the site footer copyright message can include the placeholder { year } to dynamically insert the current year. If none is provided, Blowfish will automatically generate a copyright string using the site `title`. | - #### Author + | Name | Default | Description | | ----------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `author.name` | _Not set_ | The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used. | @@ -190,6 +189,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | Name | Default | Description | | --------------- | --------- | ------------------------------------------------------------------------------------------------------------------- | | `header.layout` | `"basic"` | Defines the header for the entire site, supported values are `basic`, `fixed`, `fixed-fill`, and `fixed-fill-blur`. | + ### Footer | Name | Default | Description | @@ -199,6 +199,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `footer.showThemeAttribution` | `true` | Whether or not to show the "powered by" theme attribution in the site footer. If you choose to disable this message, please consider attributing the theme somewhere else on your site (for example, on your about page). | | `footer.showAppearanceSwitcher` | `false` | Whether or not to show the appearance switcher in the site footer. The browser's local storage is used to persist the visitor's preference. | | `footer.showScrollToTop` | `true` | When set to `true` the scroll to top arrow is displayed. | + ### Homepage | Name | Default | Description | @@ -212,6 +213,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `homepage.cardView` | `false` | Display recent articles as a gallery of cards. | | `homepage.cardViewScreenWidth` | `false` | Enhance the width of the recent articles card gallery to take the full width available. | | `homepage.layoutBackgroundBlur` | `false` | Makes the background image in the homepage layout blur with the scroll | + ### Article | Name | Default | Description | @@ -238,8 +240,8 @@ Many of the article defaults here can be overridden on a per article basis by sp | `article.invertPagination` | `false` | Whether or not to flip the direction of the next/previous article links. | | `article.showReadingTime` | `true` | Whether or not article reading times are displayed. | | `article.showTableOfContents` | `false` | Whether or not the table of contents is displayed on articles. | -| `article.showRelatedContent` | `false` | Display related content for each post. Might required additional configuration to your `config.toml`. Please check the theme `config.toml` if you want to enable this feature and copy all the relevant *related* entries. Also check [Hugo's docs](https://gohugo.io/content-management/related/) on related content. | -| `article.relatedContentLimit` | `3` | Limit of related articles to display if ` showRelatedContent` is turned on. | +| `article.showRelatedContent` | `false` | Display related content for each post. Might required additional configuration to your `config.toml`. Please check the theme `config.toml` if you want to enable this feature and copy all the relevant _related_ entries. Also check [Hugo's docs](https://gohugo.io/content-management/related/) on related content. | +| `article.relatedContentLimit` | `3` | Limit of related articles to display if `showRelatedContent` is turned on. | | `article.showTaxonomies` | `false` | Whether or not the taxonomies related to this article are displayed. | | `article.showAuthorsBadges` | `false` | Whether the `authors` taxonomies are are displayed in the article or list header. This requires the setup of `multiple authors` and the `authors` taxonomy. Check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature. | | `article.showWordCount` | `false` | Whether or not article word counts are displayed. | @@ -286,6 +288,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `taxonomy.showLikes` | `false` | Whether or not article likes are displayed. This requires firebase integrations to be enabled, look below. | | `taxonomy.showTableOfContents` | `false` | Whether or not the table of contents is displayed on taxonomies. | | `taxonomy.cardView` | `false` | Display lists as a gallery of cards. | + ### Term | Name | Default | Description | @@ -299,6 +302,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `term.groupByYear` | `false` | Whether or not articles are grouped by year on term pages. | | `term.cardView` | `false` | Display lists as a gallery of cards. | | `term.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. | + ### Firebase | Name | Default | Description | @@ -325,6 +329,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `umamiAnalytics.websiteid` | _Not set_ | The site code generated by Umami Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. | | `umamiAnalytics.domain` | _Not set_ | If using a custom domain with Umami Analytics, provide it here to serve `script.js` from the custom domain. | | `umamiAnalytics.dataDomains` | _Not set_ | If you want the tracker to only run on specific domains, provide it for your tracker script. This is a comma delimited list of domain names. Such as "yoursite.com,yoursite2.com". | +| `umamiAnalytics.scriptName` | script.js | The name of the `script.js` used for anti-ad-blocking is configured by the environment variable `TRACKER_SCRIPT_NAME` | | `umamiAnalytics.enableTrackEvent` | true | When set to `true` track event will add automatically. If you do not want to add track event, set it to `false`. | ### Seline Analytics @@ -343,6 +348,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `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" | + ### Verifications | Name | Default | Description | diff --git a/exampleSite/content/docs/configuration/index.ja.md b/exampleSite/content/docs/configuration/index.ja.md index 7a63c8594..372114742 100644 --- a/exampleSite/content/docs/configuration/index.ja.md +++ b/exampleSite/content/docs/configuration/index.ja.md @@ -15,9 +15,11 @@ The theme ships with a default configuration that gets you up and running with a {{< alert "fire" >}} We just launched a CLI tool to help you get started with Blowfish. It will help you with installation and configuration. Install the CLI tool globally using: + ```bash npx blowfish-tools ``` + {{< /alert >}} > Configuration files bundled with the theme are provided in TOML format as this is the default Hugo syntax. Feel free to convert your config to YAML or JSON if you wish. @@ -52,7 +54,7 @@ Note that the variable names provided in this table use dot notation to simplify ## Thumbnails -Blowfish was built so it would be easy to add visual support to your articles. If your familiar with Hugo article structure, you just need to place an image file (almost all formats are supported but 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. +Blowfish was built so it would be easy to add visual support to your articles. If your familiar with Hugo article structure, you just need to place an image file (almost all formats are supported but 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. [Here]({{< ref "thumbnails" >}}) is also a guide with more info and a [sample]({{< ref "thumbnail_sample" >}}) if you want to see how you can do it. @@ -92,8 +94,6 @@ The theme currently supports the following languages by default: | Simplified Chinese (China) | `zh-cn` | | Traditional Chinese (Taiwan) | `zh-tw` | - - The default translations can be overridden by creating a custom file in `i18n/[code].yaml` that contains the translation strings. You can also use this method to add new languages. If you'd like to share a new translation with the community, please [open a pull request](https://github.com/nunocoracao/blowfish/pulls). ### Configuration @@ -106,7 +106,6 @@ The default file can be used as a template to create additional languages, or re **Note:** Ensure the `defaultContentLanguage` parameter in the [site configuration](#site-configuration) matches the language code in your language config filename. {{< /alert >}} - #### Global @@ -132,10 +131,10 @@ The default file can be used as a template to create additional languages, or re | `params.description` | _Not set_ | The website description. This will be used in the site metadata. | | `params.copyright` | _Not set_ | A Markdown string for the site footer copyright message can include the placeholder { year } to dynamically insert the current year. If none is provided, Blowfish will automatically generate a copyright string using the site `title`. | - #### Author + | Name | Default | Description | | ----------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `author.name` | _Not set_ | The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used. | @@ -188,6 +187,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | Name | Default | Description | | --------------- | --------- | ------------------------------------------------------------------------------------------------------------------- | | `header.layout` | `"basic"` | Defines the header for the entire site, supported values are `basic`, `fixed`, `fixed-fill`, and `fixed-fill-blur`. | + ### Footer | Name | Default | Description | @@ -197,6 +197,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `footer.showThemeAttribution` | `true` | Whether or not to show the "powered by" theme attribution in the site footer. If you choose to disable this message, please consider attributing the theme somewhere else on your site (for example, on your about page). | | `footer.showAppearanceSwitcher` | `false` | Whether or not to show the appearance switcher in the site footer. The browser's local storage is used to persist the visitor's preference. | | `footer.showScrollToTop` | `true` | When set to `true` the scroll to top arrow is displayed. | + ### Homepage | Name | Default | Description | @@ -210,6 +211,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `homepage.cardView` | `false` | Display recent articles as a gallery of cards. | | `homepage.cardViewScreenWidth` | `false` | Enhance the width of the recent articles card gallery to take the full width available. | | `homepage.layoutBackgroundBlur` | `false` | Makes the background image in the homepage layout blur with the scroll | + ### Article | Name | Default | Description | @@ -236,8 +238,8 @@ Many of the article defaults here can be overridden on a per article basis by sp | `article.invertPagination` | `false` | Whether or not to flip the direction of the next/previous article links. | | `article.showReadingTime` | `true` | Whether or not article reading times are displayed. | | `article.showTableOfContents` | `false` | Whether or not the table of contents is displayed on articles. | -| `article.showRelatedContent` | `false` | Display related content for each post. Might required additional configuration to your `config.toml`. Please check the theme `config.toml` if you want to enable this feature and copy all the relevant *related* entries. Also check [Hugo's docs](https://gohugo.io/content-management/related/) on related content. | -| `article.relatedContentLimit` | `3` | Limit of related articles to display if ` showRelatedContent` is turned on. | +| `article.showRelatedContent` | `false` | Display related content for each post. Might required additional configuration to your `config.toml`. Please check the theme `config.toml` if you want to enable this feature and copy all the relevant _related_ entries. Also check [Hugo's docs](https://gohugo.io/content-management/related/) on related content. | +| `article.relatedContentLimit` | `3` | Limit of related articles to display if `showRelatedContent` is turned on. | | `article.showTaxonomies` | `false` | Whether or not the taxonomies related to this article are displayed. | | `article.showAuthorsBadges` | `false` | Whether the `authors` taxonomies are are displayed in the article or list header. This requires the setup of `multiple authors` and the `authors` taxonomy. Check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature. | | `article.showWordCount` | `false` | Whether or not article word counts are displayed. | @@ -284,6 +286,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `taxonomy.showLikes` | `false` | Whether or not article likes are displayed. This requires firebase integrations to be enabled, look below. | | `taxonomy.showTableOfContents` | `false` | Whether or not the table of contents is displayed on taxonomies. | | `taxonomy.cardView` | `false` | Display lists as a gallery of cards. | + ### Term | Name | Default | Description | @@ -297,6 +300,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `term.groupByYear` | `false` | Whether or not articles are grouped by year on term pages. | | `term.cardView` | `false` | Display lists as a gallery of cards. | | `term.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. | + ### Firebase | Name | Default | Description | @@ -323,6 +327,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `umamiAnalytics.websiteid` | _Not set_ | The site code generated by Umami Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. | | `umamiAnalytics.domain` | _Not set_ | If using a custom domain with Umami Analytics, provide it here to serve `script.js` from the custom domain. | | `umamiAnalytics.dataDomains` | _Not set_ | If you want the tracker to only run on specific domains, provide it for your tracker script. This is a comma delimited list of domain names. Such as "yoursite.com,yoursite2.com". | +| `umamiAnalytics.scriptName` | script.js | The name of the `script.js` used for anti-ad-blocking is configured by the environment variable `TRACKER_SCRIPT_NAME` | | `umamiAnalytics.enableTrackEvent` | true | When set to `true` track event will add automatically. If you do not want to add track event, set it to `false`. | ### Seline Analytics @@ -341,6 +346,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `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" | + ### Verifications | Name | Default | Description | diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index 57c4c9b97..7b538d1af 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -15,9 +15,11 @@ The theme ships with a default configuration that gets you up and running with a {{< alert "fire" >}} We just launched a CLI tool to help you get started with Blowfish. It will help you with installation and configuration. Install the CLI tool globally using: + ```bash npx blowfish-tools ``` + {{< /alert >}} > Configuration files bundled with the theme are provided in TOML format as this is the default Hugo syntax. Feel free to convert your config to YAML or JSON if you wish. @@ -52,7 +54,7 @@ Note that the variable names provided in this table use dot notation to simplify ## Thumbnails -Blowfish was built so it would be easy to add visual support to your articles. If your familiar with Hugo article structure, you just need to place an image file (almost all formats are supported but 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. +Blowfish was built so it would be easy to add visual support to your articles. If your familiar with Hugo article structure, you just need to place an image file (almost all formats are supported but 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. [Here]({{< ref "thumbnails" >}}) is also a guide with more info and a [sample]({{< ref "thumbnail_sample" >}}) if you want to see how you can do it. @@ -94,8 +96,6 @@ The theme currently supports the following languages by default: | Simplified Chinese (China) | `zh-cn` | | Traditional Chinese (Taiwan) | `zh-tw` | - - The default translations can be overridden by creating a custom file in `i18n/[code].yaml` that contains the translation strings. You can also use this method to add new languages. If you'd like to share a new translation with the community, please [open a pull request](https://github.com/nunocoracao/blowfish/pulls). ### Configuration @@ -108,7 +108,6 @@ The default file can be used as a template to create additional languages, or re **Note:** Ensure the `defaultContentLanguage` parameter in the [site configuration](#site-configuration) matches the language code in your language config filename. {{< /alert >}} - #### Global @@ -134,10 +133,10 @@ The default file can be used as a template to create additional languages, or re | `params.description` | _Not set_ | The website description. This will be used in the site metadata. | | `params.copyright` | _Not set_ | A Markdown string for the site footer copyright message can include the placeholder { year } to dynamically insert the current year. If none is provided, Blowfish will automatically generate a copyright string using the site `title`. | - ##### Author + | Name | Default | Description | | --------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `params.author.name` | _Not set_ | The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used. | @@ -196,6 +195,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | Name | Default | Description | | --------------- | --------- | ------------------------------------------------------------------------------------------------------------------- | | `header.layout` | `"basic"` | Defines the header for the entire site, supported values are `basic`, `fixed`, `fixed-fill`, and `fixed-fill-blur`. | + ### Footer | Name | Default | Description | @@ -205,6 +205,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `footer.showThemeAttribution` | `true` | Whether or not to show the "powered by" theme attribution in the site footer. If you choose to disable this message, please consider attributing the theme somewhere else on your site (for example, on your about page). | | `footer.showAppearanceSwitcher` | `false` | Whether or not to show the appearance switcher in the site footer. The browser's local storage is used to persist the visitor's preference. | | `footer.showScrollToTop` | `true` | When set to `true` the scroll to top arrow is displayed. | + ### Homepage | Name | Default | Description | @@ -218,6 +219,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `homepage.cardView` | `false` | Display recent articles as a gallery of cards. | | `homepage.cardViewScreenWidth` | `false` | Enhance the width of the recent articles card gallery to take the full width available. | | `homepage.layoutBackgroundBlur` | `false` | Makes the background image in the homepage layout blur with the scroll | + ### Article | Name | Default | Description | @@ -244,8 +246,8 @@ Many of the article defaults here can be overridden on a per article basis by sp | `article.invertPagination` | `false` | Whether or not to flip the direction of the next/previous article links. | | `article.showReadingTime` | `true` | Whether or not article reading times are displayed. | | `article.showTableOfContents` | `false` | Whether or not the table of contents is displayed on articles. | -| `article.showRelatedContent` | `false` | Display related content for each post. Might required additional configuration to your `config.toml`. Please check the theme `config.toml` if you want to enable this feature and copy all the relevant *related* entries. Also check [Hugo's docs](https://gohugo.io/content-management/related/) on related content. | -| `article.relatedContentLimit` | `3` | Limit of related articles to display if ` showRelatedContent` is turned on. | +| `article.showRelatedContent` | `false` | Display related content for each post. Might required additional configuration to your `config.toml`. Please check the theme `config.toml` if you want to enable this feature and copy all the relevant _related_ entries. Also check [Hugo's docs](https://gohugo.io/content-management/related/) on related content. | +| `article.relatedContentLimit` | `3` | Limit of related articles to display if `showRelatedContent` is turned on. | | `article.showTaxonomies` | `false` | Whether or not the taxonomies related to this article are displayed. | | `article.showAuthorsBadges` | `false` | Whether the `authors` taxonomies are are displayed in the article or list header. This requires the setup of `multiple authors` and the `authors` taxonomy. Check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature. | | `article.showWordCount` | `false` | Whether or not article word counts are displayed. | @@ -292,6 +294,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `taxonomy.showLikes` | `false` | Whether or not article likes are displayed. This requires firebase integrations to be enabled, look below. | | `taxonomy.showTableOfContents` | `false` | Whether or not the table of contents is displayed on taxonomies. | | `taxonomy.cardView` | `false` | Display lists as a gallery of cards. | + ### Term | Name | Default | Description | @@ -305,6 +308,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `term.groupByYear` | `false` | Whether or not articles are grouped by year on term pages. | | `term.cardView` | `false` | Display lists as a gallery of cards. | | `term.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. | + ### Firebase | Name | Default | Description | @@ -331,6 +335,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `umamiAnalytics.websiteid` | _Not set_ | The site code generated by Umami Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. | | `umamiAnalytics.domain` | _Not set_ | If using a custom domain with Umami Analytics, provide it here to serve `script.js` from the custom domain. | | `umamiAnalytics.dataDomains` | _Not set_ | If you want the tracker to only run on specific domains, provide it for your tracker script. This is a comma delimited list of domain names. Such as "yoursite.com,yoursite2.com". | +| `umamiAnalytics.scriptName` | script.js | The name of the `script.js` used for anti-ad-blocking is configured by the environment variable `TRACKER_SCRIPT_NAME` | | `umamiAnalytics.enableTrackEvent` | true | When set to `true` track event will add automatically. If you do not want to add track event, set it to `false`. | ### Seline Analytics @@ -349,6 +354,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `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" | + ### Verifications | Name | Default | Description | diff --git a/exampleSite/content/docs/configuration/index.zh-cn.md b/exampleSite/content/docs/configuration/index.zh-cn.md index c6fb3ccca..1139f86fc 100644 --- a/exampleSite/content/docs/configuration/index.zh-cn.md +++ b/exampleSite/content/docs/configuration/index.zh-cn.md @@ -19,6 +19,7 @@ Blowfish 适宜个高度定制化的主题,使用到了一些 Hugo 中最新 ```bash npx blowfish-tools ``` + {{< /alert >}} > 配置文件是基于 TOML 格式的,这也是 Hugo 默认支持的语法。当然如果你愿意,也可以将配置转换成 YAML 或 JSON 格式。 @@ -93,7 +94,6 @@ Blowfish 主题目前默认支持了以下语言: | Simplified Chinese (China) | `zh-cn` | | Traditional Chinese (Taiwan) | `zh-tw` | - 组件和静态资源的默认翻译在 `i18n/[code].yaml` 文件中,当然如果你想自定义,覆盖对应的文件即可。你也可以使用这种方法添加新的语言。如果你想与社区分享心得翻译,请[提交PR](https://github.com/nunocoracao/blowfish/pulls)。 ### 配置 @@ -106,7 +106,6 @@ Blowfish 主题目前默认支持了以下语言: **注意:** 保证 [网站设置](#site-configuration) 中的 `defaultContentLanguage`参数和你提供的语言配置文件相匹配。 {{< /alert >}} - #### 全局 @@ -132,10 +131,10 @@ Blowfish 主题目前默认支持了以下语言: | `params.description` | 无 | 网站表述。此参数将会被用作站点元数据。 | | `params.copyright` | 无 | 此参数是一个 Markdown,用于网站页脚的版权声明。此参数可以包含占位符 { year } ,以此动态插入当前年份。 如果没有提供,Blowfish 将会使用网站 `title` 自动生成版权信息。 | - #### 作者 + | 名称 | 默认值 | 描述 | | ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `author.name` | 无 | 作者名。此参数将展示在文章页脚。并且如果主页使用了个人资料布局,也会展示此值。 | @@ -273,7 +272,7 @@ Blowfish 提供了大量控制主题功能的配置参数,下面的表格中 | ----------------------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | `sitemap.excludedKinds` | `["taxonomy", "term"]` | 从生成的 `/sitemap.xml` 文件中排除的内容。 具体的配置请参考[Hugo 文档](https://gohugo.io/templates/section-templates/#page-kinds)。 | -### 分类法 +### 分类法 | 名称 | 默认值 | 描述 | | ------------------------------ | ------- | ----------------------------------------------------------------------------------------- | @@ -326,6 +325,7 @@ Blowfish 提供了大量控制主题功能的配置参数,下面的表格中 | `umamiAnalytics.websiteid` | 无 | 支持 Umami 站点分析平台。更多详细内容请参考 [分析文档]({{< ref "partials#analytics" >}})。 | | `umamiAnalytics.domain` | 无 | 如果使用自定义域名的 Umami Analytics,请在此提供,以便从自定义域名获取 `script.js`。 | | `umamiAnalytics.dataDomains` | 无 | 如果你只想在特别的数个域名中使用 tracker 功能,那么你需要设置它。这个参数的值是逗号分隔的域名列表,如:yoursite.com,yoursite2.com。 | +| `umamiAnalytics.scriptName` | script.js | 用于反广告屏蔽的 script.js 名称,由环境变量 `TRACKER_SCRIPT_NAME` 配置。 | | `umamiAnalytics.enableTrackEvent` | true | 默认会自动添加 Umami Track Event。如果你不想添加 Event,那学需要设置为 `false`。 | ### Seline Analytics @@ -335,7 +335,6 @@ Blowfish 提供了大量控制主题功能的配置参数,下面的表格中 | `selineAnalytics.token` | 无 | Seline 站点分析平台的 token。更多详细内容请参考 [分析文档]({{< ref "partials#analytics" >}})。 | | `selineAnalytics.enableTrackEvent` | true | 默认会自动添加 Umami Track Event。如果你不想添加 Event,那学需要设置为 `false`。 | - ### BuyMeACoffee(赞助平台) | 名称 | 默认值 | 描述 | @@ -345,6 +344,7 @@ Blowfish 提供了大量控制主题功能的配置参数,下面的表格中 | `buymeacoffee.globalWidgetMessage` | 无 | 新用户首次访问网站时显示的消息。 | | `buymeacoffee.globalWidgetColor` | 无 | 组件颜色,使用 HEX 格式。 | | `buymeacoffee.globalWidgetPosition` | 无 | 组件位置,例如 "Left" 或 "Right"。 | + ### 验证 | 名称 | 默认值 | 描述 | diff --git a/exampleSite/content/docs/partials/index.it.md b/exampleSite/content/docs/partials/index.it.md index 35da150d7..13225e0d7 100644 --- a/exampleSite/content/docs/partials/index.it.md +++ b/exampleSite/content/docs/partials/index.it.md @@ -44,10 +44,10 @@ googleAnalytics = "G-MEASUREMENT_ID" To enable Umami Analytics support, simply provide your [Umami tracking code](https://umami.is/docs/collect-data) in the `config/_default/params.toml` file. If you also use the custom domain feature of Umami and would like to serve their script from your domain, you can also additionally provide the `domain` configuration value. If you don't provide a `domain` value, the script will load directly from Umami DNS (analytics.umami.is). -If you want the tracker to only run on specific domains, you can provide the `dataDomains` configuration value. If you don't provide a `dataDomains` value, the script will run on any website where the `domain` and` websiteid` match. +If you want the tracker to only run on specific domains, you can provide the `dataDomains` configuration value. If you don't provide a `dataDomains` value, the script will run on any website where the `domain` and`websiteid` match. If the environment variable `TRACKER_SCRIPT_NAME` is configured, you can specify a custom script name `scriptName`. If it is not configured, either comment it out or use the default `script.js`. {{< alert >}} -**Note:** If you enable Umami Analytics, Blowfish will support [Umami Track Event](https://umami.is/docs/track-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. +**Note:** If you enable Umami Analytics, Blowfish will support [Umami Track Event](https://umami.is/docs/track-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. {{< /alert >}} ```toml @@ -57,6 +57,7 @@ If you want the tracker to only run on specific domains, you can provide the `da websiteid = "ABC12345" domain = "llama.yoursite.com" dataDomains = "yoursite.com,yoursite2.com" + scriptName = "TRACKER_SCRIPT_NAME" enableTrackEvent = true ``` @@ -65,7 +66,7 @@ If you want the tracker to only run on specific domains, you can provide the `da To enable Seline Analytics support, simply provide your [Seline token](https://seline.so/docs/install-seline) in the `config/_default/params.toml` file. {{< alert >}} -**Note:** If you enable Seline Analytics, Blowfish will support [Seline Track Event](https://seline.so/docs/custom-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. +**Note:** If you enable Seline Analytics, Blowfish will support [Seline Track Event](https://seline.so/docs/custom-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. {{< /alert >}} ```toml @@ -75,6 +76,7 @@ To enable Seline Analytics support, simply provide your [Seline token](https://s token = "XXXXXX" enableTrackEvent = true ``` + ### Custom analytics providers If you wish to use a different analytics provider on your website you can also override the analytics partial and provide your own script. Simply create the file `layouts/partials/extend-head.html` in your project and it will automatically include it in the `` of the website. diff --git a/exampleSite/content/docs/partials/index.ja.md b/exampleSite/content/docs/partials/index.ja.md index 63e826663..0c8bd31da 100644 --- a/exampleSite/content/docs/partials/index.ja.md +++ b/exampleSite/content/docs/partials/index.ja.md @@ -44,10 +44,10 @@ googleAnalytics = "G-MEASUREMENT_ID" To enable Umami Analytics support, simply provide your [Umami tracking code](https://umami.is/docs/collect-data) in the `config/_default/params.toml` file. If you also use the custom domain feature of Umami and would like to serve their script from your domain, you can also additionally provide the `domain` configuration value. If you don't provide a `domain` value, the script will load directly from Umami DNS (analytics.umami.is). -If you want the tracker to only run on specific domains, you can provide the `dataDomains` configuration value. If you don't provide a `dataDomains` value, the script will run on any website where the `domain` and` websiteid` match. +If you want the tracker to only run on specific domains, you can provide the `dataDomains` configuration value. If you don't provide a `dataDomains` value, the script will run on any website where the `domain` and`websiteid` match. If the environment variable `TRACKER_SCRIPT_NAME` is configured, you can specify a custom script name `scriptName`. If it is not configured, either comment it out or use the default `script.js`. {{< alert >}} -**Note:** If you enable Umami Analytics, Blowfish will support [Umami Track Event](https://umami.is/docs/track-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. +**Note:** If you enable Umami Analytics, Blowfish will support [Umami Track Event](https://umami.is/docs/track-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. {{< /alert >}} ```toml @@ -57,6 +57,7 @@ If you want the tracker to only run on specific domains, you can provide the `da websiteid = "ABC12345" domain = "llama.yoursite.com" dataDomains = "yoursite.com,yoursite2.com" + scriptName = "TRACKER_SCRIPT_NAME" enableTrackEvent = true ``` @@ -64,7 +65,7 @@ If you want the tracker to only run on specific domains, you can provide the `da To enable Seline Analytics support, simply provide your [Seline token](https://seline.so/docs/install-seline) in the `config/_default/params.toml` file. {{< alert >}} -**Note:** If you enable Seline Analytics, Blowfish will support [Seline Track Event](https://seline.so/docs/custom-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. +**Note:** If you enable Seline Analytics, Blowfish will support [Seline Track Event](https://seline.so/docs/custom-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. {{< /alert >}} ```toml diff --git a/exampleSite/content/docs/partials/index.md b/exampleSite/content/docs/partials/index.md index 0366655ad..d186ad9c3 100644 --- a/exampleSite/content/docs/partials/index.md +++ b/exampleSite/content/docs/partials/index.md @@ -44,10 +44,10 @@ googleAnalytics = "G-MEASUREMENT_ID" To enable Umami Analytics support, simply provide your [Umami tracking code](https://umami.is/docs/collect-data) in the `config/_default/params.toml` file. If you also use the custom domain feature of Umami and would like to serve their script from your domain, you can also additionally provide the `domain` configuration value. If you don't provide a `domain` value, the script will load directly from Umami DNS (analytics.umami.is). -If you want the tracker to only run on specific domains, you can provide the `dataDomains` configuration value. If you don't provide a `dataDomains` value, the script will run on any website where the `domain` and` websiteid` match. +If you want the tracker to only run on specific domains, you can provide the `dataDomains` configuration value. If you don't provide a `dataDomains` value, the script will run on any website where the `domain` and`websiteid` match. If the environment variable `TRACKER_SCRIPT_NAME` is configured, you can specify a custom script name `scriptName`. If it is not configured, either comment it out or use the default `script.js`. {{< alert >}} -**Note:** If you enable Umami Analytics, Blowfish will support [Umami Track Event](https://umami.is/docs/track-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. +**Note:** If you enable Umami Analytics, Blowfish will support [Umami Track Event](https://umami.is/docs/track-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. {{< /alert >}} ```toml @@ -57,6 +57,7 @@ If you want the tracker to only run on specific domains, you can provide the `da websiteid = "ABC12345" domain = "llama.yoursite.com" dataDomains = "yoursite.com,yoursite2.com" + scriptName = "TRACKER_SCRIPT_NAME" enableTrackEvent = true ``` @@ -65,7 +66,7 @@ If you want the tracker to only run on specific domains, you can provide the `da To enable Seline Analytics support, simply provide your [Seline token](https://seline.so/docs/install-seline) in the `config/_default/params.toml` file. {{< alert >}} -**Note:** If you enable Seline Analytics, Blowfish will support [Seline Track Event](https://seline.so/docs/custom-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. +**Note:** If you enable Seline Analytics, Blowfish will support [Seline Track Event](https://seline.so/docs/custom-events) automatically. If you do not want to support Track Event, the param `enableTrackEvent` must set to `false`. {{< /alert >}} ```toml diff --git a/exampleSite/content/docs/partials/index.zh-cn.md b/exampleSite/content/docs/partials/index.zh-cn.md index b1f96eae8..861969694 100644 --- a/exampleSite/content/docs/partials/index.zh-cn.md +++ b/exampleSite/content/docs/partials/index.zh-cn.md @@ -13,7 +13,6 @@ series_order: 9 Blowfish 支持了 Fathom、Google 和 Umami。Fathom 和 Umami 都是开源、简单、且注重隐私的站点分析服务,他们可以很好地替代 Google 分析。Fathom 和 Umami 都有公有云的付费版本,当然你也可以自己手动部署开源版。 - ### Fathom 要启用 Fathom Analytics 支持,只需在 `config/_default/params.toml` 文件中提供您的 Fathom 站点代码。如果您还使用 Fathom 的自定义域功能,并希望从您的域中提供脚本,还可以额外提供 `domain` 配置值。如果不提供 `domain` 值,脚本将直接从 Fath只需要在 `config/_default/params.toml` 文件提供你的 Fathom 站点代码,就可以快速支持 Fathom 站点分析。 @@ -33,7 +32,6 @@ Hugo partial 本身已经支持了 Google 站点分析。只需要在 `config/_d 版本3 (analytics.js) 和版本4 (gtag.js) 都是支持的,参考如下示例: - ```toml # config/_default/config.toml @@ -43,12 +41,11 @@ googleAnalytics = "UA-PROPERTY_ID" googleAnalytics = "G-MEASUREMENT_ID" ``` - ### Umami 只需要在 `config/_default/params.toml` 文件提供你的 [Umami 跟踪代码](https://umami.is/docs/collect-data),就可以快速支持 Umami 站点分析。 如果你想使用自定义域名来获取跟踪脚本, 那么需要提供 `domain` 参数,否则会从 Umami 云服务版的地址 (analytics.umami.is) 获取脚本。 -如果你只想在特别的数个域名中使用 tracker 功能,那么需要提供 `dataDomains` 参数。否则任何一个匹配了 `websiteid` 和 `domain` 参数值的网站,Umami 脚本都会执行。 +如果你只想在特别的数个域名中使用 tracker 功能,那么需要提供 `dataDomains` 参数。否则任何一个匹配了 `websiteid` 和 `domain` 参数值的网站,Umami 脚本都会执行。如果环境变量配置了 `TRACKER_SCRIPT_NAME` 可以填写自定义的脚本名称 `scriptName`,如果没有配置就注释掉或者填写默认的 `script.js` 。 {{< alert >}} **Note:** 开启 Umami 网站分析后, Blowfish 会自动支持 [Umami 事件追踪](https://umami.is/docs/track-events)。如果你不想支持此功能,需要把参数 `enableTrackEvent` 设置为 `false`。 @@ -62,6 +59,8 @@ googleAnalytics = "G-MEASUREMENT_ID" websiteid = "ABC12345" domain = "llama.yoursite.com" dataDomains = "yoursite.com,yoursite2.com" + scriptName = "TRACKER_SCRIPT_NAME" + enableTrackEvent = true ``` ### Seline @@ -69,7 +68,7 @@ googleAnalytics = "G-MEASUREMENT_ID" 只需要在 `config/_default/params.toml` 文件提供你的 [Seline token](https://seline.so/docs/install-seline),就可以快速支持 Seline 站点分析。 {{< alert >}} -**Note:** 开启 Seline 网站分析后, Blowfish 会自动支持 [Seline 事件追踪](https://seline.so/docs/custom-events)。如果你不想支持此功能,需要把参数 `enableTrackEvent` 设置为 `false`。 +**Note:** 开启 Seline 网站分析后, Blowfish 会自动支持 [Seline 事件追踪](https://seline.so/docs/custom-events)。如果你不想支持此功能,需要把参数 `enableTrackEvent` 设置为 `false`。 {{< /alert >}} ```toml @@ -80,7 +79,6 @@ googleAnalytics = "G-MEASUREMENT_ID" enableTrackEvent = true ``` - ### 提供自定义站点分析 如果你想在你的网站提供其他站点分析,你可以自己提供脚本,并覆盖 Blowfish 主题中内置的 partial。 @@ -92,7 +90,7 @@ Blowfish 支持了在每篇文章底部添加一个评论功能。只需要提 你可以使用 Hugo 中内置的 Disqus 模板,也可以提供自定义代码。更多内容和细节可以参考 [Hugo 文档](https://gohugo.io/content-management/comments/). -一旦提供了评论的 partial,你就可以使用 `showComments` 更细致地控制评论的显隐。此参数可以在 `params.toml` [配置文件]({{< ref "configuration#theme-parameters" >}}) 中全局设置,也可以在每篇文章的 [扉页参数]({{< ref "front-matter" >}}) 中单独针对特定文章设置。该参数默认为 `false`,因此需要在上面两个位置设置为 `true` 才能显示评论。 +一旦提供了评论的 partial,你就可以使用 `showComments` 更细致地控制评论的显隐。此参数可以在 `params.toml` [配置文件]({{< ref "configuration#theme-parameters" >}}) 中全局设置,也可以在每篇文章的 [扉页参数]({{< ref "front-matter" >}}) 中单独针对特定文章设置。该参数默认为 `false`,因此需要在上面两个位置设置为 `true` 才能显示评论。 ## 网站图标(Favicons) @@ -100,7 +98,6 @@ Blowfish 提供了一套空白网站图标以便快速上手,但你可以提 网站图标资源的位置在 `static/` 文件夹中,并务必按照如下的名称命名。如果你使用了[favicon.io](https://favicon.io),那么下载下来的文件名和下面的示例完全一致;当然你也可以通过别的方式提供,记得重命名就行。 - ```shell static/ ├─ android-chrome-192x192.png @@ -112,21 +109,18 @@ static/ └─ site.webmanifest ``` - 或者,您也可以完全覆盖默认的 favicon 行为,提供自己的 favicon HTML 标签和资源。只需在项目中提供一个 `layouts/partials/favicons.html` 文件,该文件就会被加入网站的 `` 中,取代默认资源。 ## Icon 图标 与 [图标简码]({{< ref "shortcodes#icon" >}})类似,您也可以通过使用 Blowfish 的 `icon.html` partial,在自己的模板和 partial 中加入图标。该部分包含一个参数,即要包含的图标名称。 - **示例:** ```go {{ partial "icon.html" "github" }} ``` - 图标使用 Hugo 管道填充,因此非常灵活。Blowfish 内置了大量用于社交、链接和其他用途的图标。请查看[图标示例]({{< ref "samples/icons" >}})页面,查看支持图标的完整列表。 可以通过在项目的 `assets/icons/` 目录中提供自己的图标资源来添加自定义图标。然后,可以通过使用 SVG 文件名(不含`.svg`扩展名)在局部中引用图标。 diff --git a/layouts/partials/analytics/umami.html b/layouts/partials/analytics/umami.html index 96b6cb229..12af4e610 100644 --- a/layouts/partials/analytics/umami.html +++ b/layouts/partials/analytics/umami.html @@ -1,6 +1,6 @@ {{ if isset site.Params.umamiAnalytics "domain" }}