hugo-theme-anubis2/README.md

300 lines
9.4 KiB
Markdown
Raw Normal View History

2024-01-14 10:50:55 +01:00
# Anubis2 Theme for Hugo [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) [![Netlify Status](https://api.netlify.com/api/v1/badges/7d9ea909-ad7e-4e47-b7c9-eefb7522d8c6/deploy-status)](https://app.netlify.com/sites/hugo-theme-anubis/deploys)
2020-01-12 07:51:51 +01:00
2024-01-14 10:33:50 +01:00
Anubis2 is another simple minimalist theme for [Hugo blog engine](https://gohugo.io/).
2020-01-12 07:51:51 +01:00
2024-01-04 05:14:27 +01:00
[Demo](https://www.junyi.dev/)
2024-01-04 05:14:27 +01:00
<img width="1051" alt="image" src="https://github.com/Junyi-99/hugo-theme-anubis/assets/14367694/5f68b742-4721-40ab-826a-49faa2e6f0a6">
2020-01-12 07:51:51 +01:00
## Features
2020-12-16 17:08:24 +01:00
- Dark mode (automatic / by switcher)
2020-01-12 07:51:51 +01:00
- Pagination
- Multiple taxonomies: tags, categories, authors
- Multiple sections: posts, notes, etc with customization
2020-01-12 07:51:51 +01:00
- Archive
2023-07-04 21:29:38 +02:00
- Table of Contents
2020-12-16 17:08:24 +01:00
- Open Graph and Twitter Cards support
2020-02-16 11:07:56 +01:00
- Mobile support
2021-05-17 20:04:42 +02:00
- Social icons
2020-02-16 11:07:56 +01:00
- Google Analytics
2022-08-13 08:41:36 +02:00
- Umami Analytics
2023-12-04 18:59:42 +01:00
- Comment systems: Disqus, ISSO, Utteranc.es, GraphComment, Giscus
2020-02-16 11:07:56 +01:00
- RSS feeds
2022-02-18 10:29:49 +01:00
- Related posts (Read Next section)
2022-02-17 13:31:44 +01:00
- Deploy via Netlify (config included in example site)
- Hiding posts from the RSS feed
2021-12-23 19:56:08 +01:00
- Hidden posts (available only by link)
- Translations (en, ru, fr, pl)
2020-07-09 21:42:23 +02:00
- Custom CSS/JS
- Multilingual mode
2020-06-06 15:44:52 +02:00
- Robots.txt
2020-06-06 21:05:21 +02:00
- Favorite posts
- Pagination on post single page
2020-08-12 21:25:08 +02:00
- Optional "Read more" link
2021-01-11 19:40:41 +01:00
- webmentions
2020-01-12 07:51:51 +01:00
## Installation
You need to install an extended version of Hugo to run this theme.
### As Hugo Module (easier and recommended)
Initiate a `hugo` module system from your project's root directory
```shell
hugo mod init github.com/<your_user>/<your_project>
```
Add the following to your `config.toml` or `config.yaml`
```toml
2024-01-14 10:50:55 +01:00
theme = ["github.com/Junyi-99/hugo-theme-anubis2"]
```
### As Git Submodule
2020-01-12 07:51:51 +01:00
Inside the folder of your Hugo site run:
2024-01-14 10:50:55 +01:00
$ git submodule add https://github.com/Junyi-99/hugo-theme-anubis2.git themes/anubis
2020-01-12 07:51:51 +01:00
For more information read the official [setup guide](https://gohugo.io/overview/installing/) of Hugo.
2020-01-12 07:51:51 +01:00
## Getting started
After installing the theme successfully it requires a just a few more steps to get your site running.
### Update config file
If you have toml config (which is by default), you should rename it to config.yaml or adapt this config for toml syntax.
2020-01-12 07:51:51 +01:00
Example of config.yaml:
2020-01-12 07:51:51 +01:00
```yaml
languageCode: "en-us"
2020-04-26 14:24:28 +02:00
baseUrl: ""
2020-01-12 07:51:51 +01:00
title: "Anubis"
theme: "anubis"
paginate: 10
2021-04-11 16:23:06 +02:00
disqusShortname: "yourdiscussshortname"
googleAnalytics: "G-12345"
2020-06-06 15:44:52 +02:00
enableRobotsTXT: true
2020-01-12 07:51:51 +01:00
menu:
main:
- identifier: archive
name: Archive
title: Archive
url: /posts/
weight: 0
params:
2021-01-20 19:10:47 +01:00
author: "John Doe"
email: mail@example.org # used for microformats
avatar: "/images/me.png" # used for microformats
2020-01-12 07:51:51 +01:00
description: ""
2021-06-17 12:18:18 +02:00
# Uncomment if you need this
# images:
# - images/og-featured.png # relative path to "static" directory
# customCSS:
# - css/my.css # relative path to "assets" directory (don't use main.css filename)
# customJS:
# - js/main.js # relative path to "assets" directory
2020-05-24 21:55:32 +02:00
dateFormat: "2006-01-02"
paginationSinglePost: true
2020-07-09 21:15:38 +02:00
style: light-without-switcher
mainSections: [ "posts" ] # which sections should be on index/main page
sectionsWithFullContentOnListPage: [ "notes" ] # for which sections content should be displayed on list pages
2022-02-18 10:29:49 +01:00
readMore: false # show read more button
readNextPosts: 5 # show 5 related posts, 0 by default
2021-04-13 19:20:58 +02:00
disableSummary: false
2023-07-04 21:29:38 +02:00
toc: true # display Table of Contents
tocWordCount: 300 # ...when a post is longer than 300 words
copyCodeButton: true # true by default
2022-01-19 16:49:55 +01:00
rssAsSocialIcon: true
mathjax: false # https://www.mathjax.org/
2021-01-17 17:16:45 +01:00
# utteranc.es support
utterancesRepo: "" # mandatory
utterancesTheme: "" # optional
utterancesIssue: "" # optional
utterancesLabel: "" # optional
# isso support
isso:
enabled: true # mandatory
data: "https://comments.example.com/" # mandatory
jsLocation: "https://comments.example.com/js/embed.min.js" # mandatory
css: true # optional
lang: "de" # optional
replyToSelf: true # mandatory
requireAuthor: true # mandatory
requireEmail: true # mandatory
id: "thread-id" # optional
avatar: true # optional
avatar-bg: "#f0f0f0" # optional
2022-05-22 11:37:59 +02:00
feed: false # optional
2022-08-13 08:41:36 +02:00
UmamiAnalytics:
enabled: true # mandatory
dnt: true # optional
id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # mandatory
datacache: false # optional
2022-08-13 08:45:43 +02:00
url: "https://abc.example.com/umami.js" # mandatory
2022-02-26 15:30:52 +01:00
graphcommentId: ""
2023-12-04 18:59:42 +01:00
# giscus support
GiscusRepo: "" # mandatory
GiscusRepoId: "" # mandatory
GiscusCategory: "Announcements" # mandatory
GiscusCategoryId: "" # mandatory
GiscusLazyLoad: false # optional
2021-01-11 19:40:41 +01:00
webmentions:
url: https://yourdomain.com/webemntions/receive
2021-01-11 19:40:41 +01:00
login: hugo-theme-anubis
pingback: true
2021-05-17 20:04:42 +02:00
social:
- id: github
name: gohugoio
# - id: hugo
# url: "https://gohugo.io/"
# icon: "hugo"
markup:
goldmark:
renderer:
unsafe: true # enable raw HTML in Markdown
2020-01-12 07:51:51 +01:00
```
### Check your site
In order to see your site in action, run Hugo's built-in local server.
`$ hugo server`
Now enter [`localhost:1313`](http://localhost:1313/) in the address bar of your browser.
2020-05-07 19:05:13 +02:00
## Feature Settings
2020-07-09 21:15:38 +02:00
### Dark Mode
Customize via `style` param in `params` section of config.
Options:
- `light-without-switcher` - light theme, without switcher (by default)
- `dark-without-switcher` - dark theme, without switcher
- `auto-without-switcher` - theme based on user system settings, without switcher
2020-07-09 21:19:33 +02:00
- `light` - light theme by default, can be switched by user to dark theme and back. Theme settings are saved for user
- `dark` - dark theme by default, can be switched by user to light theme and back. Theme settings are saved for user
2021-11-02 17:01:55 +01:00
- `auto` - theme based on user system settings by default, can be switched by user to dark/light theme. Theme settings are saved for user (by default in example sites)
2020-07-09 21:15:38 +02:00
2023-07-04 21:29:38 +02:00
### Table of Contents
If `toc` param in `params` section of the config file is set to `true`,
Table of Contents is generated for every post that is at least `tocWordCount`
words long (`0` by default, also belongs to the `params` section of the config).
This behavior can be overridden on per-post basis
by setting `toc` to either `true` or `false` in the front matter of a post.
2021-05-17 20:04:42 +02:00
### Social icons
#### Predefined icons
To add icon from predefined list, add to `params.social` config:
- id of social network
- name for placeholder (usually it's your nickname or login)
Predefined list:
- email
- facebook
- github
- instagram
- linkedin
- mastodon (need full url)
2021-05-17 20:04:42 +02:00
- patreon
- reddit
- snapchat
- soundcloud
- spotify
- telegram
- twitch
- twitter
- vk
- youtube
Example:
```
- id: github
name: gohugoio
```
Config like this generate github icon with "https://github.com/gohugoio" url.
#### Predefined icons with custom url
2023-07-24 12:08:05 +02:00
To add predefined icon with custom url, add to `params.social` config:
- id of social network
- full url to your network
Example:
```
- id: github
url: "https://github.com/gohugoio/hugo"
```
Config like this generate github icon with "https://github.com/gohugoio/hugo" url.
2021-05-17 20:04:42 +02:00
#### Custom icons
To add custom icon, add to `params.social` config:
- id of social network/site
- full url to your network/site
2021-05-17 20:04:42 +02:00
Also you need to create directory `static/fa-icons` and add svg icon of your network/site with name equals to `id` from config.
Example:
```
- id: google
url: "https://www.google.com/search?q=I'm+lucky"
```
Icon should be "static/fa-icons/google.svg"
If you want font awesome icons, download "Font Awesome For Desktop" and open svg directory.
2020-05-07 19:05:13 +02:00
### Google Analytics
Only works for production environment.
2020-05-07 19:05:13 +02:00
### Multilingual mode
2024-01-14 10:50:55 +01:00
Check config/example usage in [exampleSiteMultilingual](https://github.com/Junyi-99/hugo-theme-anubis2/tree/master/exampleSiteMultilingual) directory and documentation on [Hugo site](https://gohugo.io/content-management/multilingual/).
2022-01-19 16:49:55 +01:00
### RSS
RSS is available by site url + /index.xml. Also available for specific language, section, taxonomy.
2023-07-24 12:08:05 +02:00
`rssAsSocialIcon` parameter enables rss social icon with link to site current language RSS.
2022-01-19 16:49:55 +01:00
2020-06-06 15:44:52 +02:00
### Robots.txt
2020-06-06 21:05:21 +02:00
Based on environment.
For production — allow all, for other — disallow all.
2020-06-06 15:44:52 +02:00
2020-06-06 21:05:21 +02:00
### Favorite posts
2021-12-23 19:56:08 +01:00
Add `favorite: true` to post front matter. It adds a "★" icon nearby post's title.
2020-06-06 21:05:21 +02:00
2022-02-18 10:29:49 +01:00
### Related posts (Read Next section)
Based on `readNextPosts` config parameter. Check [this article](https://gohugo.io/content-management/related/#configure-related-content) for configuration details.
2020-06-06 21:05:21 +02:00
2021-01-23 16:15:00 +01:00
### Hiding posts from RSS
2021-12-23 19:56:08 +01:00
Add `disable_feed: true` to post front matter.
### Make post available only by link
Add `hidden: true` to post front matter. Post also is not available in RSS feed.
2021-01-23 16:15:00 +01:00
### Pagination on post single page
Enabled by `paginationSinglePost` param in `params` section of config.
### Webmentions
To provide webmention support you can **either** specify your webmention.io username with `login: webmentionusername` **or** specify a link to your custom webmention endpoint with `url: https://yourdomain.com/webemntions/receive`.
If you use webmention.io you can also enable pingback with `pingback: true`
2022-04-12 19:11:58 +02:00
### Disabling comments per-page basis
Add `disableComments: true` to post front matter.
2023-08-03 18:36:21 +02:00
## Custom shortcodes
### Video (for local videofiles)
Example: `{{< video src="/media/movie.mp4" type="video/mp4" preload="auto" caption="Some caption" alt="Some alt" >}}`
2020-01-12 07:51:51 +01:00
## Contributing
2024-01-14 10:50:55 +01:00
If you find a bug or have an idea for a feature, feel free to write an [issue](https://github.com/Junyi-99/hugo-theme-anubis2/issues) or make a PR.
2020-01-12 07:51:51 +01:00
## TODO
2024-01-14 10:50:55 +01:00
See [issues](https://github.com/Junyi-99/hugo-theme-anubis2/issues).
2020-01-12 07:51:51 +01:00
## License
MIT
2020-08-08 10:25:27 +02:00
© Dmitry Kolosov
2020-05-07 19:05:13 +02:00
2020