add i18n 404 and README support (#132)

* feat(params.toml): enable analytics and configure Umami Analytics

Enable analytics by setting `enable` to `true` in the `[analytics]` section of the `params.toml` file. Also, configure Umami Analytics by providing the `data_website_id`, `src`, and `data_domains` values.

* feat(404.html): replace hardcoded "404 page not found" text with translated version to improve localization

* feat(README.md): add README.md file with information about the Bridget theme and its features
feat(getStarted.md): add getStarted.md file with instructions on how to get started with the Bridget theme, including installation and content management instructions
This commit is contained in:
Spedon
2023-11-06 16:07:56 +08:00
committed by GitHub
parent 8c2138ce3b
commit f083407889
16 changed files with 244 additions and 7 deletions

42
README.md Normal file
View File

@@ -0,0 +1,42 @@
# Bridget
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/Sped0n/bridget/build.yml?logo=github) ![GitHub deployments](https://img.shields.io/github/deployments/Sped0n/bridget/Production?logo=vercel&label=deploy)
Bridget is a minimal [Hugo](https://gohugo.io) theme designed for photographers / visual artists.
Its based on the https://github.com/tylermcrobert/bridget-pictures-www.
## Getting Started
Head to this [documentation](https://github.com/Sped0n/bridget/blob/main/doc/getStarted.md) for a complete guidance to get started with the Bridget theme.
## Feature
- **Blazingly fast**: 99/100 on mobile and 100/100 on desktop in [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights)
- JS **dynamic loading** (powered by ES6 syntax)
- JS **code splitting** by [rollup.js](https://rollupjs.org)
- Image **Preloading**/**Lazy loading**
- **Dynamic resolution** based on view mode
- Multiple **analytics** services supported
- Search engine **verification** supported (Google, Bind, Yandex and Baidu)
## Multilingual and i18n
Bridget supports the following languages:
- English
- Simplified Chinese
- Traditional Chinese
- Japanese
- Korean
- Deutsch
- Spanish
- Italian
- [Contribute with a new language](https://github.com/Sped0n/bridget/pulls)
## Credits
- https://github.com/tylermcrobert/bridget-pictures-www
- https://www.youtube.com/watch?v=Jt3A2lNN2aE
- https://github.com/d4cho/bridget-pictures-clone

171
doc/getStarted.md Normal file
View File

@@ -0,0 +1,171 @@
# Getting Started
The files in `exampleSite` is just a simple example. Now, we will introduce it based on the same structure.
## Requirements
Before you start, make sure you have installed Hugo **extended version**. For more information, see [Hugo's documentation](https://gohugo.io/getting-started/installing/).
Once you have installed Hugo, you can check the version by running the following command:
```shell
hugo version
```
Which should output something like this (the version number may be different), notice the `extended` keyword:
```shell
hugo v0.120.3-a4892a07b41b7b3f1f143140ee4ec0a9a5cf3970+extended darwin/arm64 BuildDate=2023-11-01T17:57:00Z VendorInfo=brew
```
The minimum required Hugo version can be seen in the [`theme.toml`](https://github.com/Sped0n/bridget/blob/main/theme.toml#L19).
## Installation
### Git
On the main branch, you can find the theme's latest source code. To use the latest version, you can clone the repository to `themes/bridget` by running the following command in the root directory of your Hugo site:
```shell
git clone https://github.com/Sped0n/bridget themes/bridget
```
If you are already using Git for your site, you can add the theme as a submodule by running the following command in the root directory of your Hugo site:
```shell
git submodule add https://github.com/Sped0n/bridget themes/bridget
```
### Module (recommended)
> If you want to modify the theme, use Git installation instead.
This theme is also available as a [Hugo module](https://gohugo.io/hugo-modules/). Run the following command in the root directory of your Hugo site:
First turn your site into a Hugo module (in case you haven't done it yet):
```shell
hugo mod init github.com/me/my-new-site
# or whatever you like, it doesnt necessarily have to be a GitHub link.
hugo mod init blablabla
```
Then import the theme as a dependency adding the following line to the `module` section of your site's configuration file.
```toml
# config/_default/hugo.toml
[module]
[[module.imports]]
path = "github.com/Sped0n/bridget"
```
If you want to upgrade the theme, just run:
```shell
hugo mod get -u
```
## Content Management
The content is where the pictures/text is stored, while the static refers to the website icons.
```
.
├── content
│ ├── Erwitt
│ │ ├── 1.jpg
│ │ ├── ***
│ │ └── index.md
│ ├── Gruyaert
│ │ ├── 1.jpg
│ │ ├── ***
│ │ └── index.md
│ ├── Info
│ │ └── index.md
│ └── Webb
│ ├── 1.jpg
│ ├── ***
│ └── index.md
└── static
├── dot.png
└── dot.svg
```
In each index.md file, there is a configuration file like this:
```markdown
---
type: _default
layout: single
url: /erwitt/
menu:
main:
weight: 3
identifier: Erwitt
title: Erwitt
unifiedAlt: '© Elliott Erwitt'
---
```
- keep the `type` and `layout` **untouched**;
- `url` is the href link to this page, in this case, you can visit this page with `blabla.com/erwitt`;
- `main` is the entry to `menu`;
- `weight` determines the position of this link in the navigation bar, with the first one being 1, the second one being 2, and so on;
- `identifier` should be the **same** as the name of the **upper-level directory**;
- `title` refers to the text that appears on the navigation bar;
- `unifiedAlt` is **optional**, If you left it empty, the alt attribute of the image will default to its file name; if it is set, the alt attributes of all images will be unified to the value you have set;
- If this is a **showcase** page, simply place the images in the same directory as index.md.
- If this is an **information** page, you can continue writing the information you want to display in index.md.
> However, please note that the CSS for the information page **only provides simple styling for text**. If you have any requirements beyond text and the browser rendering does not meet your expectations, please modify [`_article.scss`](https://github.com/Sped0n/bridget/blob/main/assets/scss/_partial/_article.scss).
As for the **website icon**, place the files in static and then go to config part for further reading.
## Config
You can simply copy this to the root directory of your site with minor modifications, and youll be ready to proceed.
```
.
└── config
└── _default
├── hugo.toml
├── markup.toml
├── params.toml
└── sitemap.toml
```
### `hugo.toml`
We will focus on introducing the part about `theme as module`, detailed comments are provided for other options, so we wont repeat them here.
```toml
# theme as module
[module]
replacements = "github.com/Sped0n/bridget -> ../.."
[[module.imports]]
path = "github.com/Sped0n/bridget"
```
- If you want to <u>modify the theme</u> or you have <u>installation with Git</u>, please keep the `replacements` configuration and change the path after the arrow to the location of your local theme file.
- If you have <u>installation with Module</u>, remove the `replacements` configuration.
### `markup.toml`
**DO NOT TOUCH THIS**
### `params.toml`
There is a detailed description in the comments.
### `sitemap.toml`
https://gohugo.io/templates/sitemap-template/#configuration

View File

@@ -30,7 +30,7 @@ sogou = ""
# Analytics config # Analytics config
[analytics] [analytics]
enable = false enable = true
# Google Analytics # Google Analytics
[analytics.google] [analytics.google]
id = "" id = ""
@@ -46,10 +46,10 @@ server = ""
id = "" id = ""
# Umami Analytics # Umami Analytics
[analytics.umami] [analytics.umami]
data_website_id = "" data_website_id = "44a4a42d-ec8e-44c9-a38c-7533929e9845"
src = "" src = "https://umami.sped0nwen.com/script.js"
data_host_url = "" data_host_url = ""
data_domains = "" data_domains = "bridget-demo.sped0nwen.com"
# Plausible Analytics # Plausible Analytics
[analytics.plausible] [analytics.plausible]
data_domain = "" data_domain = ""

View File

@@ -6,3 +6,5 @@ other = "vorher"
other = "schließen" other = "schließen"
[threshold] [threshold]
other = "schwelle" other = "schwelle"
[404]
other = "seite nicht gefunden"

View File

@@ -6,3 +6,5 @@ other = "prev"
other = "close" other = "close"
[threshold] [threshold]
other = "threshold" other = "threshold"
[404]
other = "page not found"

View File

@@ -6,3 +6,5 @@ other = "previo"
other = "cerrar" other = "cerrar"
[threshold] [threshold]
other = "umbral" other = "umbral"
[404]
other = "página no encontrada"

View File

@@ -6,3 +6,5 @@ other = "précédent"
other = "fermer" other = "fermer"
[threshold] [threshold]
other = "seuil" other = "seuil"
[404]
other = "page non trouvée"

View File

@@ -6,3 +6,5 @@ other = "precedente"
other = "chiudi" other = "chiudi"
[threshold] [threshold]
other = "soglia" other = "soglia"
[404]
other = "pagina non trovata"

View File

@@ -6,3 +6,5 @@ other = "後退"
other = "閉じる" other = "閉じる"
[threshold] [threshold]
other = "しきい値" other = "しきい値"
[404]
other = "ページが見つかりません"

View File

@@ -6,3 +6,5 @@ other = "물러나세요"
other = "닫기" other = "닫기"
[threshold] [threshold]
other = "임계값" other = "임계값"
[404]
other = "페이지를 찾을 수 없습니다"

View File

@@ -6,3 +6,5 @@ other = "后退"
other = "关闭" other = "关闭"
[threshold] [threshold]
other = "阈值" other = "阈值"
[404]
other = "页面不存在"

View File

@@ -6,3 +6,5 @@ other = "後退"
other = "關閉" other = "關閉"
[threshold] [threshold]
other = "閾值" other = "閾值"
[404]
other = "找不到頁面"

View File

@@ -6,3 +6,5 @@ other = "後退"
other = "關閉" other = "關閉"
[threshold] [threshold]
other = "閾值" other = "閾值"
[404]
other = "找不到頁面"

View File

@@ -6,3 +6,5 @@ other = "后退"
other = "关闭" other = "关闭"
[threshold] [threshold]
other = "阈值" other = "阈值"
[404]
other = "页面不存在"

View File

@@ -6,3 +6,5 @@ other = "後退"
other = "關閉" other = "關閉"
[threshold] [threshold]
other = "閾值" other = "閾值"
[404]
other = "找不到頁面"

View File

@@ -9,8 +9,8 @@
{{- partial "nav.html" . -}} {{- partial "nav.html" . -}}
</div> </div>
<article class="info"> <article class="info">
<p class="error">&#9949; <u>404</u> page not found &#9949;</p> <p class="error">&#9949; <u>404</u>&nbsp;{{- i18n 404 -}}&nbsp;&#9949;</p>
<p class="error">&#9949; <u>404</u> page not found &#9949;</p> <p class="error">&#9949; <u>404</u>&nbsp;{{- i18n 404 -}}&nbsp;&#9949;</p>
<p class="error">&#9949; <u>404</u> page not found &#9949;</p> <p class="error">&#9949; <u>404</u>&nbsp;{{- i18n 404 -}}&nbsp;&#9949;</p>
</article> </article>
{{- end -}} {{- end -}}