Compare commits

...

9 Commits

Author SHA1 Message Date
Wen Junhua 0c479cda5b
Merge 8a8ae76bf2 into 16edb5da3b 2023-11-26 20:07:51 +08:00
James Panther 16edb5da3b
📝 Update changelog 2023-11-26 16:25:55 +11:00
James Panther 041fc30fe9
🔀 Merge pull request #691 from stereobooster/portable-links-2
Print warning if system can't resolve link to a markdown file
2023-11-26 16:23:01 +11:00
James Panther a9f79b7495
🔥 Remove Fathom Analytics custom domain parameter 2023-11-26 16:20:04 +11:00
Wen Junhua 8a8ae76bf2 docs: update author docs 2023-11-25 12:51:22 +08:00
Wen Junhua 4b3d31eff3 fix: move param under languages.xx.toml params.author 2023-11-25 12:29:10 +08:00
Wen Junhua 394a018e08 feat: add warning when config is incorrect 2023-11-12 19:09:16 +08:00
Wen Junhua 2dd90e3d20 feat: move author field to params.toml 2023-11-12 18:52:28 +08:00
stereobooster e70c968e56 Print warning if system can't resolve link to a markdown file 2023-10-31 16:54:45 +01:00
23 changed files with 63 additions and 51 deletions

View File

@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased]
### Added
- Warning when building if links to markdown files cannot be resolved ([#691](https://github.com/jpanther/congo/pull/691))
### Removed
- Fathom Analytics custom domain parameter as this is no longer supported by Fathom
## [2.7.6] - 2023-11-26
### Fixed

View File

@ -12,7 +12,7 @@ title = "Congo"
# mainSections = ["section1", "section2"]
# description = "My awesome website"
[author]
[params.author]
# name = "Your name here"
# image = "img/author.jpg"
# headline = "I'm only human"

View File

@ -68,7 +68,6 @@ fingerprintAlgorithm = "sha256"
[fathomAnalytics]
# site = "ABC12345"
# domain = "llama.yoursite.com"
[plausibleAnalytics]
# domain = "blog.yoursite.com"

View File

@ -12,7 +12,7 @@ copyright = "© 2023 Congo contributors"
mainSections = ["samples"]
description = "Ein leistungsstarkes, leichtgewichtiges Theme für Hugo, das mit Tailwind CSS erstellt wurde."
[author]
[params.author]
name = "Congo"
image = "img/author.jpg"
headline = "Nicht dein Durschnitts-Theme!"

View File

@ -12,7 +12,7 @@ copyright = "© 2023 Congo contributors"
mainSections = ["samples"]
description = "A powerful, lightweight theme for Hugo built with Tailwind CSS."
[author]
[params.author]
name = "Congo"
image = "img/author.jpg"
headline = "Not your ordinary theme!"

View File

@ -12,7 +12,7 @@ copyright = "© 2023 Congo contributors"
mainSections = ["samples"]
description = "Un tema poderoso y liviano para Hugo creado con Tailwind CSS."
[author]
[params.author]
name = "Congo"
image = "img/author.jpg"
headline = "¡No es tu tema ordinario!"

View File

@ -12,7 +12,7 @@ copyright = "© 2023 Congo contributors"
mainSections = ["samples"]
description = "Tailwind CSSをベースに開発された強力で軽量なHugo向けテーマ"
[author]
[params.author]
name = "Congo"
image = "img/author.jpg"
headline = "ただならぬテーマ!"

View File

@ -68,7 +68,6 @@ fingerprintAlgorithm = "sha256"
[fathomAnalytics]
# site = "ABC12345"
# domain = "llama.yoursite.com"
[verification]
# google = ""

View File

@ -100,11 +100,11 @@ Congoは現在、以下の言語に対応しています:
|`params.dateFormat`|`"2 January 2006"`|日付の書式。許容される書式については、[Hugo docs](https://gohugo.io/functions/format/#gos-layout-string)を参照してください。|
|`params.mainSections`|_Not set_|最近の記事リストに表示するセクション。指定されていない場合は、記事の数が最も多いセクションが使われます。|
|`params.description`|_Not set_|ウェブサイトの説明。これはサイトのメタデータに使用されます。|
|`author.name`|_Not set_|著者の名前。これは記事のフッターと、プロフィールレイアウトが使用されている場合にホームページに表示されます。|
|`author.image`|_Not set_|著者の画像ファイルへのパス。画像は縦横比1:1で、 `assets/` に置くこと。|
|`author.headline`|_Not set_|著者の見出しを含むMarkdown文字列。プロフィールのトップページで著者の名前の下に表示されます。|
|`author.bio`|_Not set_|著者の経歴を含むMarkdown文字列。記事のフッターに表示されます。|
|`author.links`|_Not set_|著者の詳細とともに表示するリンク。設定ファイルにはリンクの例が含まれており、コメントを外すだけで有効にすることができます。リンクが表示される順番は、配列に表示される順番によって決まります。 `assets/icons/` に対応するSVGアイコンを用意することで、カスタムリンクを追加することもできます。|
|`params.author.name`|_Not set_|著者の名前。これは記事のフッターと、プロフィールレイアウトが使用されている場合にホームページに表示されます。|
|`params.author.image`|_Not set_|著者の画像ファイルへのパス。画像は縦横比1:1で、 `assets/` に置くこと。|
|`params.author.headline`|_Not set_|著者の見出しを含むMarkdown文字列。プロフィールのトップページで著者の名前の下に表示されます。|
|`params.author.bio`|_Not set_|著者の経歴を含むMarkdown文字列。記事のフッターに表示されます。|
|`params.author.links`|_Not set_|著者の詳細とともに表示するリンク。設定ファイルにはリンクの例が含まれており、コメントを外すだけで有効にすることができます。リンクが表示される順番は、配列に表示される順番によって決まります。 `assets/icons/` に対応するSVGアイコンを用意することで、カスタムリンクを追加することもできます。|
<!-- prettier-ignore-end -->
### メニュー
@ -169,7 +169,6 @@ Congoはテーマの機能を制御する多数の設定パラメーターを提
|`sitemap.excludedKinds`|`["taxonomy", "term"]`|生成される `/sitemap.xml` から除外されるべきコンテンツの種類。許容される値については[Hugo docs](https://gohugo.io/templates/section-templates/#page-kinds)を参照してください。|
|`taxonomy.showTermCount`|`true`|TaxonomiesのリストにTermごとの記事数を表示するかどうか。|
|`fathomAnalytics.site`|_Not set_|Fathom Analyticsによって生成されたウェブサイトのサイトコード。詳細は[アナリティクス]({{< ref "partials#" >}})を参照してください。|
|`fathomAnalytics.domain`|_Not set_|Fathom Analyticsでカスタムドメインを使用している場合、カスタムドメインから`script.js`を提供するためにここに指定します。|
|`verification.google`|_Not set_|サイトのメタデータに含めるGoogleが提供するサイト検証文字列。|
|`verification.bing`|_Not set_|サイトのメタデータに含めるBingが提供するサイト検証文字列。|
|`verification.pinterest`|_Not set_|サイトのメタデータに含めるPinterestが提供するサイト検証文字列。|

View File

@ -100,11 +100,11 @@ The default file can be used as a template to create additional languages, or re
|`params.dateFormat`|`"2 January 2006"`|How dates are formatted in this language. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.|
|`params.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.|
|`params.description`|_Not set_|The website description. This will be used in the site metadata.|
|`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.|
|`author.image`|_Not set_|Path to the image file of the author. The image should be a 1:1 aspect ratio and placed in the site's `assets/` folder.|
|`author.headline`|_Not set_|A Markdown string containing the author's headline. It will be displayed on the profile homepage under the author's name.|
|`author.bio`|_Not set_|A Markdown string containing the author's bio. It will be displayed in article footers.|
|`author.links`|_Not set_|The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`.|
|`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.|
|`params.author.image`|_Not set_|Path to the image file of the author. The image should be a 1:1 aspect ratio and placed in the site's `assets/` folder.|
|`params.author.headline`|_Not set_|A Markdown string containing the author's headline. It will be displayed on the profile homepage under the author's name.|
|`params.author.bio`|_Not set_|A Markdown string containing the author's bio. It will be displayed in article footers.|
|`params.author.links`|_Not set_|The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`.|
<!-- prettier-ignore-end -->
### Menus
@ -169,7 +169,6 @@ Many of the article defaults here can be overridden on a per article basis by sp
|`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.|
|`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.|
|`plausibleAnalytics.domain`|_Not set_|Enter the domain of the website you want to track. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.|
|`plausibleAnalytics.event`|_Not set_|Plausible api event proxied URL. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.|
|`plausibleAnalytics.script`|_Not set_|Plausible analysis script proxied URL. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.|

View File

@ -38,7 +38,7 @@ languageCode = "en"
title = "My awesome website"
[author]
[params.author]
name = "My name"
image = "img/author.jpg"
headline = "A generally awesome human"
@ -48,7 +48,7 @@ links = [
]
```
`[author]` はウェブサイト上でどのように著者情報を表示するかを決定します。画像はサイトの `assets/` に置きましょう。リンクはリストの記述順に沿って表示されます。
`[params.author]` はウェブサイト上でどのように著者情報を表示するかを決定します。画像はサイトの `assets/` に置きましょう。リンクはリストの記述順に沿って表示されます。
各設定に関する詳細情報は、[設定]({{< ref "configuration" >}})セクションで説明されています。

View File

@ -38,7 +38,7 @@ The language code in the language config filename should match the `languageCode
title = "My awesome website"
[author]
[params.author]
name = "My name"
image = "img/author.jpg"
headline = "A generally awesome human"
@ -48,7 +48,7 @@ links = [
]
```
The `[author]` configuration determines how the author information is displayed on the website. The image should be placed in the site's `assets/` folder. Links will be displayed in the order they are listed.
The `[params.author]` configuration determines how the author information is displayed on the website. The image should be placed in the site's `assets/` folder. Links will be displayed in the order they are listed.
If you need extra detail, further information about each of these configuration options, is covered in the [Configuration]({{< ref "configuration" >}}) section.

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -10,18 +10,21 @@ tags: ["partials", "analytics", "privacy", "comments", "favicons", "icon", "docs
## Analytics
Congo provides built-in support for Fathom Analytics and Google Analytics. Fathom is a paid alternative to Google Analytics that respects user privacy. If you're interested you can use this affiliate link to [receive $10 credit](https://usefathom.com/ref/RLAJSV) and try the service.
Congo provides support for various analytics providers out of the box, as well as the ability to include custom code for any provider of your choice. If you don't currently have an analytics provider, check out Fathom Analytics.
### Fathom Analytics
To enable Fathom Analytics support, simply provide your Fathom site code in the `config/_default/params.toml` file. If you also use the custom domain feature of Fathom 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 Fathom DNS.
Fathom Analytics is a privacy-first service that is a great alternative to Google Analytics. It allows you to get all the visitor information you need, without spying on them. As a Congo user, you can use this affiliate link to [receive $10 credit](https://usefathom.com/ref/RLAJSV) and try the service.
[![Fathom Analytics. Website analytics without compromise. Zero cookies, GDPR compliant, and privacy-first. Start a free trial.](fathom-analytics.jpg)](https://usefathom.com/ref/RLAJSV)
To enable Fathom Analytics support, simply provide your Fathom site code in the `config/_default/params.toml` file. The script will load in your site directly from the Fathom Analytics CDN.
```toml
# config/_default/params.toml
[fathomAnalytics]
site = "ABC12345"
domain = "llama.yoursite.com"
```
### Plausible Analytics

View File

@ -2,10 +2,16 @@
{{- $isRemote := strings.HasPrefix $link "http" -}}
{{- if not $isRemote }}
{{ $url := urls.Parse .Destination }}
{{ if $url.Path }}
{{- if $url.Path }}
{{ $fragment := "" }}
{{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}}
{{- with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end -}}
{{ end }}
{{- with .Page.GetPage $url.Path }}
{{ $link = printf "%s%s" .RelPermalink $fragment }}
{{ else }}
{{- if hasSuffix $url.Path ".md" }}
{{ warnf "[CONGO] Can't resolve: %s" .Destination }}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
<a href="{{ $link | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank" rel="noreferrer"{{ end }}>{{- .Text | safeHTML -}}</a>

View File

@ -1,10 +1,6 @@
{{ if hugo.IsProduction }}
{{ with .Site.Params.fathomAnalytics.site }}
{{ if isset $.Site.Params.fathomanalytics "domain" }}
<script defer src="https://{{ $.Site.Params.fathomanalytics.domain }}/script.js" data-site="{{ . }}"></script>
{{ else }}
<script defer src="https://cdn.usefathom.com/script.js" data-site="{{ . }}"></script>
{{ end }}
<script defer src="https://cdn.usefathom.com/script.js" data-site="{{ . }}"></script>
{{ end }}
{{ with site.Params.plausibleAnalytics.domain }}
<script defer

View File

@ -1,4 +1,4 @@
{{ with .Site.Author.links }}
{{ with .Site.Language.Params.Author.links }}
<div class="flex flex-wrap text-neutral-400 dark:text-neutral-500">
{{ range $links := . }}
{{ range $name, $url := $links }}

View File

@ -1,6 +1,6 @@
{{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
<div class="flex">
{{ with .Site.Author.image }}
{{ with .Site.Language.Params.Author.image }}
{{ $authorImage := resources.Get . }}
{{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "192x192 Center" }}
@ -8,7 +8,7 @@
class="!mb-0 !mt-0 me-4 h-24 w-24 rounded-full"
width="96"
height="96"
alt="{{ $.Site.Author.name | default "Author" }}"
alt="{{ $.Site.Language.Params.Author.name | default "Author" }}"
src="{{ $authorImage.RelPermalink }}"
{{ if $.Site.Params.enableImageLazyLoading | default true }}
loading="lazy"
@ -17,7 +17,7 @@
{{ end }}
{{ end }}
<div class="place-self-center">
{{ with .Site.Author.name | markdownify | emojify }}
{{ with .Site.Language.Params.Author.name | markdownify | emojify }}
<div class="text-[0.6rem] uppercase leading-3 text-neutral-500 dark:text-neutral-400">
{{ i18n "author.byline_title" | markdownify | emojify }}
</div>
@ -25,7 +25,7 @@
{{ . }}
</div>
{{ end }}
{{ with .Site.Author.bio | markdownify | emojify }}
{{ with .Site.Language.Params.Author.bio | markdownify | emojify }}
<div class="text-sm text-neutral-700 dark:text-neutral-400">{{ . }}</div>
{{ end }}
<div class="text-2xl sm:text-lg">{{ partialCached "author-links.html" . }}</div>

View File

@ -86,7 +86,7 @@
{{- else }}
&copy;
{{ now.Format "2006" }}
{{ .Site.Author.name | markdownify | emojify }}
{{ .Site.Language.Params.Author.name | markdownify | emojify }}
{{- end }}
</p>
{{ end }}

View File

@ -7,3 +7,6 @@
{{ if ne .Params.logo nil }}
{{ warnf "[CONGO] Theme parameter `logo` has been renamed to `header.logo`. Please update your site configuration." }}
{{ end }}
{{ if .Author }}
{{ warnf "[CONGO] Theme parameter `.Site.author` in `languages.xx.toml` has been renamed to `.Site.Language.Params.Author` in `params.toml`. Please update your site configuration." }}
{{ end }}

View File

@ -117,8 +117,8 @@
{{/* Schema */}}
{{ partial "schema.html" . }}
{{/* Me */}}
{{ with .Site.Author.name }}<meta name="author" content="{{ . }}" />{{ end }}
{{ with .Site.Author.links }}
{{ with .Site.Language.Params.Author.name }}<meta name="author" content="{{ . }}" />{{ end }}
{{ with .Site.Language.Params.Author.links }}
{{ range $links := . }}
{{ range $name, $url := $links }}<link href="{{ $url }}" rel="me" />{{ end }}
{{ end }}

View File

@ -4,7 +4,7 @@
{{ end }} flex flex-col items-center justify-center text-center"
>
<header class="mb-3 flex flex-col items-center">
{{ with .Site.Author.image }}
{{ with .Site.Language.Params.Author.image }}
{{ $authorImage := resources.Get . }}
{{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "288x288 Center" }}
@ -12,15 +12,15 @@
class="mb-2 h-36 w-36 rounded-full"
width="144"
height="144"
alt="{{ $.Site.Author.name | default "Author" }}"
alt="{{ $.Site.Language.Params.Author.name | default "Author" }}"
src="{{ $authorImage.RelPermalink }}"
/>
{{ end }}
{{ end }}
<h1 class="text-4xl font-extrabold">
{{ .Site.Author.name | default .Site.Title }}
{{ .Site.Language.Params.Author.name | default .Site.Title }}
</h1>
{{ with .Site.Author.headline }}
{{ with .Site.Language.Params.Author.headline }}
<h2 class="text-xl text-neutral-500 dark:text-neutral-400">
{{ . | markdownify | emojify }}
</h2>

View File

@ -11,7 +11,7 @@
{{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }}
"publisher" : {
"@type": "Person",
"name": "{{ .Site.Author.name | safeJS }}"
"name": "{{ .Site.Language.Params.Author.name | safeJS }}"
}
}
</script>
@ -30,7 +30,7 @@
"url" : "{{ .Permalink }}",
"author" : {
"@type": "Person",
"name": "{{ .Site.Author.name | safeJS }}"
"name": "{{ .Site.Language.Params.Author.name | safeJS }}"
},
{{ with .PublishDate }}"copyrightYear": "{{ .Format "2006" }}",{{ end }}
{{ with .Date }}"dateCreated": "{{ .Format $iso8601 }}",{{ end }}