source: tanzpartie-hugo/themes/bilberry-hugo-theme/README.md @ 17849

Last change on this file since 17849 was 16971, checked in by Henrik Bettermann, 2 years ago
File size: 39.8 KB
Line 
1# Bilberry Hugo Theme
2[![GitHub version](https://img.shields.io/github/release/Lednerb/bilberry-hugo-theme/all.svg?style=flat-square)](https://github.com/Lednerb/bilberry-hugo-theme/releases)
3[![Hugo Version](https://img.shields.io/badge/Hugo-%5E0.83.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
4[![Hugo Themes](https://img.shields.io/badge/Hugo_Themes-@Bilberry-ff4088)](https://themes.gohugo.io/themes/bilberry-hugo-theme/)
5
6[![Build GH-Pages](https://github.com/Lednerb/bilberry-hugo-theme/workflows/Update%20GitHub%20Pages/badge.svg)](https://github.com/Lednerb/bilberry-hugo-theme/deployments/activity_log?environment=github-pages)
7[![Contributors](https://img.shields.io/badge/contributors-41-orange.svg?style=flat-square)](#contributors)
8[![License](https://img.shields.io/github/license/Lednerb/bilberry-hugo-theme.svg?style=flat-square)](https://github.com/Lednerb/bilberry-hugo-theme/blob/master/LICENSE.md)
9
10**Bilberry** is a premium [Hugo](https://gohugo.io) theme with many great features.
11This is an adaptation and further optimization of the [Lingonberry WordPress theme](https://en-ca.wordpress.org/themes/lingonberry/) by Anders Norén.
12
13Here's a live [demo site](https://lednerb.github.io/bilberry-hugo-theme) to see this theme in action.
14
15## Support and Discussions
16
17Support for this theme is provided through the [Issues](https://github.com/Lednerb/bilberry-hugo-theme/issues) and [Discussions](https://github.com/Lednerb/bilberry-hugo-theme/discussions) sections of the project.
18Please use the **Issues** section if you would like to report a defect or bug. For any other requests, use the **Discussions** section.
19
20Please use the following guidelines if you want to start a discussion:
21- For any questions regarding a specific feature, or if you need help using or customizing the theme, use the **Questions & Answers** (**Q&A**) category.
22- To propose a new feature or any other improvements, use the **Ideas** category.
23- To showcase your blog or website powered by Bilberry theme, use the **Show and tell** category.
24- For any other inquiries, please use the **General** type discussion.
25 
26## Table of Contents
27
28- [Requirements](#requirements)
29- [Quick Start](#quick-start)
30  - [Site Initial Setup](#site-initial-setup)
31  - [Theme Installation Options](#theme-installation-options)
32    - [Option 1 (recommended): Adding the Theme as a Hugo Module](#option-1-recommended-adding-the-theme-as-a-hugo-module)
33    - [Option 2: Cloning/Copying the Theme Files](#option-2-cloningcopying-the-theme-files)
34  - [Configuration](#configuration)
35  - [Webserver](#webserver)
36  - [Other Tutorials](#other-tutorials)
37- [Features](#features)
38  - [Post Types](#post-types)
39  - [Top Navigation Bar](#top-navigation-bar)
40  - [Algolia Search](#algolia-search)
41    - [Initial Setup](#initial-setup)
42    - [Update Algolia Index](#update-algolia-index)
43      - [Manual Upload](#manual-upload)
44      - [Automated Upload](#automated-upload)
45  - [Keyboard Shortcuts](#keyboard-shortcuts)
46  - [Reposted Article/Duplicated Content](#reposted-articleduplicated-content)
47  - [Calculated Reading Rime](#calculated-reading-time)
48  - [Summary Splits](#summary-splits)
49    - [Automatic Summary Split](#automatic-summary-split)
50    - [Manual Summary Split](#manual-summary-split)
51    - [Front Matter Summary Split](#front-matter-summary-split)
52    - [No Summary Split](#no-summary-split)
53  - [Table of Contents (TOC)](#table-of-contentstoc)
54  - [Series Taxonomy](#series-taxonomy)
55  - [Google Analytics](#google-analytics)
56  - [Comments](#comments)
57    - [Commento](#commento)
58    - [Disqus](#disqus)
59    - [Giscus](#giscus)
60    - [Utterances](#utterances)
61  - [Responsive Design](#responsive-design)
62  - [Automatic Image Resizing](#automatic-image-resizing)
63  - [Image Modal Zoom](#image-modal-zoom)
64  - [MathJAX Markup](#mathjax-markup)
65  - [Disabled Javascript Support](#disabled-javascript-support)
66  - [Video](#video)
67  - [Audio](#audio)
68  - [Raw HTML](#raw-html)
69- [Favicons](#favicons)
70- [Custom 404 Page](#custom-404-page)
71- [Archive Page](#archive-page)
72- [Custom Post Types](#custom-post-types)
73- [External Images](#external-images)
74- [Customizing Individual Posts](#customizing-individual-posts)
75- [Custom Colors and Fonts](#custom-colors-and-fonts)
76- [CSS and JS modules](#css-and-js-modules)
77  - [Add Cookie Disclaimer](#add-cookie-disclaimer)
78- [Translations](#translations)
79- [Credits](#credits)
80- [Contributors](#contributors)
81- [License](#license)
82
83## Requirements
84- **Hugo** (version >= 0.83.0), see this [guide](https://gohugo.io/getting-started/installing/) on how to install Hugo.
85- **Git**, see this [guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) on how to install Git.
86- **Go** (version >= 1.18), optional, required only when the Bilberry theme is used as a Hugo module; see this [guide](https://go.dev/doc/install) on how to install Go.
87
88## Quick Start
89
90### Site Initial Setup
91- Clone the Bilberry Hugo theme repository to your local computer:
92```shell
93git clone https://github.com/Lednerb/bilberry-hugo-theme.git
94```
95Alternatively, you can download it as a [ZIP](https://github.com/Lednerb/bilberry-hugo-theme/archive/master.zip) file and extract into the `bilberry-hugo-theme` directory.
96
97- Create a new site:
98```shell
99hugo new site my-new-blog
100```
101
102- Delete the default archetype:
103```shell
104rm my-new-blog/archetypes/default.md
105```
106
107- Copy the example site content including the `config.toml` file:
108```shell
109cp -r bilberry-hugo-theme/exampleSite/* my-new-blog
110```
111
112
113### Theme Installation Options
114#### Option 1 (recommended): Adding the Theme as a Hugo Module
115Use this option if you want to pull in the theme files from the main Bilberry Hugo theme repository.
116This option makes it easy to keep the theme up to date in your site.
117
118- Initialize your website as a Hugo module from the site's root:
119```shell
120cd my-new-blog
121hugo mod init github.com/<your-user>/my-new-blog
122```
123
124Following the Hugo module initialization, you may have the following warning: module "
125github.com/Lednerb/bilberry-hugo-theme/v3" not found, which should be ignored.
126
127- Pull theme files to add new content to your website:
128
129```shell
130hugo mod vendor
131```
132
133If you need more details on how to use Hugo modules, please read
134the [Hugo documentation](https://gohugo.io/hugo-modules/use-modules/).
135
136#### Option 2: Cloning/Copying the Theme Files
137Use this option if you want to directly customize and maintain your own copy of the theme.
138
139- In the `my-new-blog/config.toml` file, uncomment the `theme` property for **Option 2**, and
140  comment out the `theme` property for **Option 1**:
141```toml
142# Option 1 (recommended): adding the theme as a hugo module
143# theme = "github.com/Lednerb/bilberry-hugo-theme/v3"
144
145# Option 2: cloning/copying the theme files
146theme = "bilberry-hugo-theme"
147```
148
149- Copy cloned (or unzipped) theme files in previous step to the `my-new-blog/themes` directory:
150```shell
151cp -r bilberry-hugo-theme my-new-blog/themes/bilberry-hugo-theme
152```
153**Important:** Do NOT change the name of the `themes/bilberry-hugo-theme` folder in your site's root.
154Renaming this folder will break your site.
155
156### Configuration
157
158To customize website according to your needs, edit the `config.toml` file in the site's root
159directory by adjusting the settings. All parameters that need to be configured are commented out or
160disabled.
161
162The Algolia Search is enabled in the `config.toml` file that comes with the example site; therefore,
163if you don't plan to use it, disable it by setting the `algolia_search` property to `false`.
164
165### Webserver
166- To build and serve the site, execute the following command from the site's root:
167```shell
168cd my-new-blog
169hugo server
170```
171
172### Other Tutorials
173- [Start Blogging With Hugo, GitHub, and Netlify](https://www.kiroule.com/article/start-blogging-with-github-hugo-and-netlify/)
174- [Configure Custom Domain and HTTPS on Netlify](https://www.kiroule.com/article/configure-custom-domain-and-https-in-netlify/)
175- [Manage Environment-Specific Settings for Hugo-Based Website](https://www.kiroule.com/article/manage-environment-specific-settings-for-hugo-based-website/)
176
177## Features
178
179### Post Types
180Bilberry theme comes with a set of predefined post types, namely `article`, `audio`, `code`, `gallery`, `link`, `page`, `quote`, `status`, and `video` where the `article` type is the default one.
181
182To create a new content, use the `hugo new` command. Content can be created in two ways: a single page or a [page bundle](https://gohugo.io/content-management/page-bundles/).
183
184To create new content as a single page, you can use the following command:
185```shell
186hugo new <content-type>/my-single-page-content.md
187```
188Or, new page bundle content can be created as follows:
189```shell
190hugo new <content-type>/my-page-bundle-content/index.md
191```
192
193For example, you can create a new article as a single page and a new gallery as a page bundle using the following commands respectively:
194```shell
195hugo new article/my-single-page-article.md
196hugo new gallery/my-page-bundle-gallery/index.md
197```
198
199The `page` post type is the only one that can be used in the top navigation bar.
200Pages can be ordered using the `weight` front matter variable, which should be set to a non-zero value.
201A page with a lower `weight` will be displayed first.
202
203The `page` content can be a static page, such as an **About** page, or a link to another page, internal or external.
204
205The `link` post type always links to an external site and can be used with or without a background image.
206
207
208### Top Navigation Bar
209If you want to permanently display the top navigation bar with the search text field and `page` items, set the `permanentTopNav` parameter to `true` in the `config.toml` file.
210
211Please note that the top navigation bar is minimized by default on mobile devices.
212
213
214### Algolia Search
215Bilberry theme includes built-in content search via [Algolia SAAS](https://www.algolia.com/).
216You can see this in action on the [demo site](https://lednerb.github.io/bilberry-hugo-theme) by clicking on "hamburger" and typing something in the search text field, such as "support."
217
218#### Initial Setup
219To enable and configure search functionality for your site, follow these steps:
220
2211. Register for a free Algolia Search account on https://www.algolia.com/.
2222. Add a `New Application`. You can choose the `COMMUNITY` plan.
2233. Switch over to `Indices` and create a new index.
2244. Switch over to `API Keys` and copy your `Application ID`, `Search-Only API Key` and chosen `Index name` to your `config.toml` file.
2255. Make sure that the `algolia_search` parameter is set to  `true`.
2266. Follow instructions in the section [Update Algolia Index](#update-algolia-index) and proceed to the next step.
2277. To complete the initial setup, go to the tab `Configuration` of your newly created indices, select the `Facets` in the section `FILTERING AND FACETING` and add the `language` attribute with the `filter only` modifier in the `Attributes for faceting` option. If, after adding the `language` attribute, the `Unknown attribute` error is shown, ignore it.
228
229#### Update Algolia Index
230You have to repeat this step every time you change a post or publish a new one to update the search index.
231
232Execute the `hugo` command in the site's root directory to generate the index file.
233
234##### Manual Upload
2351. Head over to the `public/index.json` file and copy its content.
2362. Login to your Algolia account, open your index and click at `Add records manually`.
2373. Paste the copied text from the `index.json` file.
2384. Verify in the `Browse` tab of your index that the index records were uploaded correctly.
2395. In case you have a multi-language setup, make sure that you repeat the steps above for all `public/{LANG}/index.json` files.
240
241##### Automated Upload
2421. Switch to the `algolia` directory and install required dependencies by executing the following command:
243  ```shell script
244  cd algolia
245  npm install
246  ```
2472. Run the `data-upload.js` from from the `algolia` directory as follows:
248  ```shell script
249  npm run data-upload -- -f ../public/index.json -a <algolia-app-id> -k <algolia-admin-api-key> -n <algolia-index-name>
250  ```
2513. The `algolia-admin-api-key` argument, namely your Algolia account's `Admin API Key`, is used to create, update, and delete indices, and it should be kept secret.
2524. Add the `-c` or `--clear-index` option if you want to clear the corresponding Algolia index before starting a new upload.   
2535. Login to your Algolia account and verify in the `Browse` tab of your index that the index records were uploaded correctly.
2546. In case you have a multi-language setup, make sure that you repeat the steps above for all `public/{LANG}/index.json` files.
255
256Also, you can read this [write-up](https://www.kiroule.com/article/automate-data-upload-to-algolia-index-revisited/) on how to automate
257data upload to Algolia index if you host your Bilberry theme-based website on Netlify, or this [write-up](https://www.kiroule.com/article/automate-data-upload-to-algolia-index-with-github-actions/) using GitHub Actions.
258
259
260### Keyboard Shortcuts
261Type `s` to open the navigation bar and set focus to the search input field.
262To remove focus, press the `Esc` key.
263
264
265### Reposted Article/Duplicated Content
266If you need to repost an article from another website or duplicate content on your site, you should link it to the original URL so it's correctly processed by SEO.
267To do so, define the `original_url` front matter variable in your post, for example:
268```
269original_url: "https://example.org/path/to/content"
270```
271
272
273### Calculated Reading Time
274To override the automatically calculated reading time for a post, you can use the `readingTime` front matter variable, for example:
275```
276readingTime: 7 # integer value in  minutes
277```
278
279
280### Summary Splits
281There are three options for how Hugo can generate summaries of content which will be used as a short version in summary views, such as a home page and tags or categories pages.
282
283#### Automatic Summary Split
284Using first 70 words of your content, Hugo automatically generates the summary followed by the _Continue reading_ link. 
285
286#### Manual Summary Split
287Add the `<!--more-->` summary divider to your content.
288Any content before the divider will be used by Hugo as a summary of that content.
289The generated summary will also be followed by the _Continue reading_ link.
290
291#### Front Matter Summary Split
292To define a summary that differs from the text that starts your article, use the `summary` front matter variable, for example, `summary: "Here goes my summary"`.
293This summary will also be followed by the _Continue reading_ link.
294
295#### No Summary Split
296If you want to display the entire article without the _Continue Reading_ link, set the `noSummary` variable to `true` in your content file.
297
298
299### Table of Contents (TOC)
300To enable the automatic creation of a table of contents (TOC), set the `toc` front matter variable to `true` in your article.
301If the article's markdown contains appropriate headings, Hugo will generate a table of content at the beginning of the article.
302
303By default, a TOC is generated if the content's word count is greater than **400**.
304The `tocMinWordCount` parameter defines this value in the `config.toml` configuration file.
305
306The headings that are taken into account for a TOC are from _H2_ (##) to _H5_ (#####) inclusive.
307Also, if you want to display a TOC at a specific point in your article, set the `toc` front matter variable to `false`, and use the `toc` shortcode like this:
308```markdown
309{{< toc >}}
310```
311
312
313### Series Taxonomy
314In case you want to group some articles as a series, you have to add the `series` front matter variable to each article and set its value to the name of the series, for example, `series: "My New Super Series"`.
315
316The page at `<site-base-url>/series/` will list all the series. To list all articles for a particular series within markdown, you can use the `series` shortcode with the series name in question, for instance:
317```markdown
318{{< series "My New Super Series" >}}
319```
320
321### Google Analytics
322Bilberry theme comes with built-in support for both v3 and v4 of [Google Analytics](https://analytics.google.com/analytics/web/).
323You should set the value of the `googleAnalytics` property in the `config.toml` file to enable it.
324
325Such value for Universal Analytics v3 is prefixed with the `UA` letters.
326So, suppose you migrate your existing website to the Bilberry theme, and your website is already tracked in Universal Analytics, given that the corresponding property was created before October 14, 2020.
327In that case, you should continue using the v3 value in the `config.toml` file.
328But given that Universal Analytics will no longer process new data in standard properties beginning July 1, 2023, you will have to create a Google Analytics v4 property linked to your v3 property.
329
330If you created your property after October 14, 2020, you're likely using a Google Analytics v4 property already, and the value for such property is prefixed with the `G` letter.
331In that case, you should use the v4 value in the `config.toml` file.
332
333### Comments
334To allow readers to comment under your articles, you can use either [Commento](https://commento.io/), [Disqus](https://disqus.com/), [Giscus](https://giscus.app/), or [Utterances](https://utteranc.es/).
335
336#### Commento
337Follow this [guide](https://docs.commento.io/installation/cloud-service/) if you want to use Commento Cloud Service which is not free of cost.
338
339In case you want to use Self-hosting Commento, follow these [instructions](https://docs.commento.io/installation/self-hosting/).
340
341Then uncomment the `commentoJsURL` parameter in the `config.toml` file:
342```toml
343#[...]
344[params]
345    #[...]
346
347    # Commento
348    commentoJsURL = "http://localhost:8080/js/commento.js"
349```
350
351#### Disqus
352To allow readers to leave comments under your articles, sign up for free on [Disqus](https://disqus.com) website.
353Then create a new site and set the `disqusShortname` parameter to your site's short name in the `config.toml` file:
354```toml
355#[...]
356[params]
357    #[...]
358
359    # Disqus
360    disqusShortname = "lednerb"
361```
362
363You can manage and moderate the comments either on your website or using the Disqus management panel.
364
365#### Giscus
366Follow instructions on [Giscus](https://giscus.app/) website.
367Once you complete the prerequisites for your GitHub repository and select a discussion category, values for `giscusRepositoryId` and `giscusCategoryId` will be automatically generated.
368Then, in the `config.toml` file, set the `giscus` parameter to `true` and the properties mentioned above, respectively:
369```toml
370#[...]
371[params]
372    #[...]
373
374    # Giscus
375    giscus              = true
376    giscusJsUrl         = "https://giscus.app/client.js"
377    giscusRepository    = "Lednerb/bilberry-hugo-theme"
378    giscusRepositoryId  = "R_kgDOGX153A" # generated by Giscus website
379    giscusMapping       = "pathname"
380    giscusCategory      = "General"
381    giscusCategoryId    = "DIC_kwDOGX153M4B_2Vz" # generated by Giscus website
382    giscusTheme         = "light"
383    giscusReactions     = "1"
384    giscusEmitMetadata  = "0"
385    giscusLanguage      = "en"
386    giscusCrossOrigin   = "anonymous"
387```
388
389#### Utterances
390Follow instructions on [Utterances](https://utteranc.es/) website.
391Once you complete the prerequisites for your GitHub repository, set the `utterances` parameter to `true` in the `config.toml` file:
392```toml
393#[...]
394[params]
395    #[...]
396
397    # Utterances
398    utterances            = true
399    utterancesJsUrl       = "https://utteranc.es/client.js"
400    utterancesRepository  = "Lednerb/bilberry-hugo-theme"
401    utterancesIssueTerm   = "pathname"
402    utterancesLabel       = "Comment"
403    utterancesTheme       = "github-light"
404    utterancesCrossOrigin = "anonymous"
405```
406
407### Responsive Design
408Bilberry theme is optimized to look good on all devices, namely desktops, tablets and smartphones.
409
410### Automatic Image Resizing
411Bilberry theme includes built-in automatic cropping and resizing only for **featured** and **gallery** images, activated by default.
412However, if you want to disable it, set the `resizeImages` parameter to `false` in the `config.toml` file.
413Also, this feature can be disabled at the post level by setting the `resizeImages` front matter variable to `false`.
414
415For a featured image to be cropped and resized, it should be named `featuredImage.*` where the `*` is the image file extension, e.g., `jpg`, `png`, etc.
416Also, it should be placed within the page bundle in question, for example:
417```shell
418content
419└── article
420    └── my-post-with-featured-image
421        ├── featuredImage.png
422        └── index.md
423```
424**NOTE**: a featured image defined via the `featuredImage` front matter parameter will **NOT** be cropped and resized.
425
426### Image Modal Zoom
427When you include an image that is larger than the content area, the image becomes interactive and a larger version can be opened in a lightbox.
428
429
430### MathJAX Markup
431To enable the [MathJAX](https://www.mathjax.org) markup support, set the `enable_mathjax` parameter to `true` in the `config.toml` file.
432
433
434### Disabled Javascript Support
435Although this theme has a lot of features that only work with enabled JavaScript, it also fully supports disabled JavaScript.
436Disabled Javascript will not break any styling or essential functionalities of your website.
437
438You can test the behavior of the [demo site](https://lednerb.github.io/bilberry-hugo-theme) by disabling JavaScript in your browser.
439
440
441### Video
442The following video hosting providers are supported: [YouTube](https://www.youtube.com/), [Vimeo](https://vimeo.com/),  [Prezi](https://prezi.com/), [Bilibili](https://www.bilibili.com), and [PeerTube](https://joinpeertube.org).
443Videos in the `MP4` format, either stored externally or within the site's `static` folder, are also supported.
444There are two options to display video embeds.
445
446The first option is to use a post of the `video` type. Use the following command to create your video post:
447```bash
448hugo new video/<post-name>.md
449```
450
451Then set the appropriate front matter variable while removing the others:
452```markdown
453youtube: "<youtube-video-id>"            # https://www.youtube.com/watch?v=M7IjJiZUutk -> "M7IjJiZUutk"
454vimeo: "<vimeo-video-id>"                # https://vimeo.com/239830182 -> "239830182"
455prezi: "<prezi-video-id>"                # https://prezi.com/v/5z9shnq7jzxs/what-to-study/ -> "5z9shnq7jzxs"
456bilibili: "<bilibili-video-id>"          # https://www.bilibili.com/video/BV1Sx411T7QQ -> "BV1Sx411T7QQ"
457peertube: "<peertube-video-id>"          # https://vids.tekdmn.me/w/w7WGHX7Lb6mCrbrpF3Xb8V (entire URL)
458mp4video: "<video-file-url>"             # location of video file (only mp4)
459mp4videoImage: "<image-video-file-url>"  # location of poster image
460```
461
462For example, if an `MP4` video and its image are stored in the `static` folder, you can set corresponding front matter variables as follows:
463```markdown
464mp4video: "/<video-file-name>.mp4"
465mp4videoImage: "/<image-video-file-name>.png"
466```
467
468The second option is to use the `video` shortcode within markdown content in a post of the `article` type as follows:
469```markdown
470<!-- YouTube -->
471{{< video type="youtube" id="<youtube-video-id>" >}}
472
473<!-- Vimeo -->
474{{< video type="vimeo" id="<vimeo-video-id>" >}}
475
476<!-- Prezi -->
477{{< video type="prezi" id="<prezi-video-id>" >}}
478
479<!-- bilibili -->
480{{< video type="bilibili" id="<bilibili-video-id>" >}}
481
482<!-- PeerTube -->
483{{< video type="peertube" id="<peertube-video-id>" >}}
484
485<!-- MP4 external -->
486{{< video type="mp4" url="<video-file-url>" imageUrl="<image-video-file-url>" >}}
487
488<!-- MP4 in site's static folder -->
489{{< video type="mp4" url="/<video-file-name>.mp4" imageUrl="/<image-video-file-name>.png" >}}
490
491```
492
493#### PeerTube Configuration
494Because there is no *one* PeerTube site, you need to indicate which ones your videos use, meaning you can't use just the video ID.
495Instead, copy in the entire watch URL, and it'll be transformed into the correct embed URL to use.
496
497There is an [instance finder](https://joinpeertube.org/instances#instances-list) if you want to start hosting your videos on PeerTube but don't know which instance to join.
498
499### Audio
500The following audio streaming providers are supported: [Mixcloud](https://www.mixcloud.com/), [SoundCloud](https://soundcloud.com/), [Spotify](https://www.spotify.com/), and [TuneIn](https://tunein.com/).
501Audio files in the `Ogg`, `MP3`, or `WAV` formats, either stored externally or within the site's `static` folder, are also supported.
502There are two options to display audio embeds.
503
504The first option is to use a post of the `audio` type. Use the following command to create your audio post:
505```bash
506hugo new audio/<post-name>.md
507```
508
509Then set the appropriate front matter variable while removing the others:
510```markdown
511spotify: "<spotify-track-id>"        # https://open.spotify.com/track/3W2lz1sg6m4sEzjmoTjmdE?si=0659fd12179840dd --> 3W2lz1sg6m4sEzjmoTjmdE
512soundcloud: "<soundcloud-track-url>" # https://soundcloud.com/lightbooks/alchemist-08-new-world-order-snip
513tunein: "<tunein-track-id>"          # https://tunein.com/embed/player/t117894382/" --> t117894382
514mixcloud: "<mixcloud-track-id>"      # https://www.mixcloud.com/scienceforthepeople/445-ai-ant-intelligence/ --> scienceforthepeople/445-ai-ant-intelligence
515audiofile: "<audio-file-url>"        # location of audio file (only ogg, mp3, or wav formats)
516```
517
518For example, if an `MP3` audio file is stored in the `static` folder, you can set the `audiofile` front matter variable as follows:
519```markdown
520audiofile: "/<audio-file-name>.mp3"
521```
522
523The second option is to use the `audio` shortcode within markdown content in a post of the `article` type as follows:
524```markdown
525<!-- Mixcloud -->
526{{< audio type="mixcloud" id="<mixcloud-track-id>" >}}
527
528<!-- SoundCloud -->
529{{< audio type="soundcloud" id="<soundcloud-track-url>" >}}
530
531<!-- Spotify -->
532{{< audio type="spotify" id="<spotify-track-id>" >}}
533
534<!-- TuneIn -->
535{{< audio type="tunein" id="<tunein-track-id>" >}}
536
537<!-- MP3 external -->
538{{< audio type="audiofile" url="<audio-file-url>" >}}
539
540<!-- MP3 in site's static folder -->
541{{< audio type="audiofile" url="/<audio-file-name>.mp3" >}}
542```
543
544### Raw HTML
545If you want to include raw HTML in your markdown content, set the `unsafe` setting in the `config.toml` file to `true`:
546```toml
547[markup.goldmark]
548  [markup.goldmark.renderer]
549    unsafe = true
550```
551
552## Favicons
553To add favicons, proceed with the following steps:
5541. Visit https://realfavicongenerator.net/ website, and generate favicons according to your needs.
5552. Copy and paste the generated files into your site's `/static` folder.
5563. Edit the `/layouts/partials/favicon.html` file, then copy and paste the HTML code from the generated instruction.
557
558**Important:** You have to follow the [Quick Start](#Quick-Start) instructions or manually copy the `/layouts/partials/favicon.html` file from the theme to your site's `/layouts` directory.
559
560Also, check out this [tutorial](https://www.kiroule.com/article/add-favicon-to-hugo-based-website/) on how to add favicons to Bilberry theme-based website.
561
562
563## Custom 404 Page
564To customize your 404 page, copy the `themes/bilberry-hugo-theme/layouts/404.html` file to your site's `layouts/404.html` and edit the file according to your needs, for example, change the message, icon class etc.
565
566## Archive Page
567The archive page will be available at `<site-base-url>/archive/` as soon as you copy the `themes/bilberry-hugo-theme/exampleSite/content/archive.md` file to `content` directory of your site.
568By default, the published content is grouped by year.
569To group the content by year and month, set the `archiveDateGrouping` parameter to the `2006-01` value.
570
571To display the archive link in the footer, set the `showArchive` parameter to `true`.
572
573To add the archive link to the top navigation bar, create a new page with the following command:
574```shell
575hugo new page/archive.md
576```
577
578Then, in the newly created `content/page/archive.md` file, set the `link` front matter variable to the `/archive/` value and completely remove the `target` variable.
579
580
581## Custom Post Types
582With Bilberry theme, you can create new post types easily.
583For example, suppose you want to create a new type named `book`.
584Then you should do the following:
585
5861. Copy the default `themes/bilberry-hugo-theme/layouts/partials/content-type/article.html` to your site's `layouts/partials/content-type/` folder.
5872. Rename the file to your custom post type, namely `book.html`.
5883. Customize the newly created file, for instance, change the icon in the bubble to `fa-book` that is available on [Font Awesome Icon](http://fontawesome.io/icons/) website:
589```html
590<i class="fas fa-fw fa-book"></i>
591```
5924. To create new posts, use the `book` post type prefix:
593```shell
594hugo new book/my-favorite-book.md`
595```
596If you want to use custom front matter variables, create a `book.md` archetype in your site's `archetypes/` directory.
597
598## External Images
599If you would like to use external images, such as those stored on another server or in the cloud, as a featured image for your article or in the `gallery` post type, you can use them by setting the appropriate front matter variables with the full-path URL values:
600
601```markdown
602# /content/article/my-external-featured-image-post.md
603featuredImage: "https://example.org/images/my-image.jpg"
604```
605
606```markdown
607# /content/gallery/my-external-gallery-post.md
608gallery: [
609    "https://example.org/images/gallery-image1.jpg",
610    "https://example.org/images/gallery-image2.jpg",
611    "https://example.org/images/gallery-image3.jpg"
612]
613```
614
615## Individual Posts Customization
616You can customize your posts as follows:
617
6181. To exclude posts from your blog's index but still show up in categories, add `excludeFromIndex: true` to your post's front matter.
619
6202. To pin one or more posts to the top of the index page, uncomment the `pinnedPost` parameter in the `config.toml` file.
621Then set its value to the post's relative URL, for example, `/article/installing-bilberry-theme/`.
622When pinning multiple posts, the relative URL values should be separated by a comma.
623The `pinOnlyToFirstPage` parameter allows you to choose whether to display pinned posts on the index page only or on all pages.
624
6253. A custom icon can be declared per post, by specifying a font-awesome icon in the post's front matter, such as `icon: fa-thumb-tack` for a pinned post.
626
6274. If you want to change the default post types(e.g., replace the pencil icon for the `article` post type another one) copy the original content type file to your site's `layouts/partials/content-type/` directory and edit it there.
628Otherwise, your changes will be overwritten when you update the theme to the latest version.
629
630
631## Custom Colors and Fonts
632Bilberry uses SCSS for styling and NPM with [Laravel Mix](https://laravel-mix.com/) for the dependency management.
633
634To change any colors or fonts, you have to follow these steps:
635
6361. In your site's `cd themes/bilberry-hugo-theme` directory, execute `npm install`.
6372. Modify the `assets/sass/_variables.scss` file to customize your colors.
638If you want to change the header's color, only edit the `$base-color` variable.
6393. Use `npm run dev` for development and preview purposes and `npm run production` when you're done with the changes.
640
641
642## CSS and JS modules
643This theme supports hot-swappable CSS and JavaScript extensions.
644Modules can be specified using the `(css|js)_modules` list parameter.
645Modules can be specified either relative to the `static` directory (e.g. `exampleSite/static/css/custom.css`) or as a URL.
646
647Modules are imported in the order they appear in the list, and immediately after the default Bilberry CSS and JS files are imported.
648
649## Add Cookie Disclaimer
650You can use the [cookie consent](https://cookieconsent.insites.com/) solution to add cookie consent information by loading the needed resources as external CSS and JS modules.
651
652Use the configurator on the [cookie consent website](https://cookieconsent.insites.com/) to generate the required initialization code and add it to a local `static/init-cookieconsent.js` file, for example:
653
654```javascript
655// https://cookieconsent.insites.com/download/#
656window.addEventListener('load', function () {
657  window.cookieconsent.initialise({
658    'palette': {
659      'popup': {
660        'background': '#cc0033'
661      },
662      'button': {
663        'background': '#fff'
664      }
665    }
666  })
667})
668```
669
670Then you only need to modify the `config.toml` file to load the local init script and the libraries.
671You can either download the files and put them in your site's `/static` directory or reference them directly using a CDN.
672Storing these files on your website reduces external dependencies, increases privacy, and allows you to develop your website in an offline environment.
673
674```toml
675css_modules = ["..", "//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css"]
676js_modules = ["..", "//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js", "init-cookieconsent.js"]
677```
678
679
680## Translations
681Bilberry theme has built-in support for multi-language sites, and currently supports translations for more than 20 languages.
682
683Feel free to submit a request for a new language translation or improve existing ones!
684
685## Credits
686Bilberry theme was inspired by the [WordPress theme Lingonberry](https://en-ca.wordpress.org/themes/lingonberry/) created by Anders Norén.
687
688Bilberry is a theme for the great [HUGO static site generator](https://gohugo.io).
689
690Special thank-you goes to [@Ipstenu](https://github.com/Ipstenu) for his help in [this thread](https://discourse.gohugo.io/t/search-index-json-file-for-lunr-js/6286/5?u=lednerb) that helped to create the `index.json` for the Algolia index.
691
692## Contributors
693
694Many thanks go to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
695
696<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
697<!-- prettier-ignore -->
698| [<img src="https://avatars1.githubusercontent.com/u/2056876?v=4" width="100px;"/><br /><sub><b>Sascha Brendel</b></sub>](https://sascha-brendel.de)<br />[💬](#question-Lednerb "Answering Questions") [📝](#blog-Lednerb "Blogposts") [💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=Lednerb "Code") [🎨](#design-Lednerb "Design") [📖](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=Lednerb "Documentation") [🌍](#translation-Lednerb "Translation") | [<img src="https://anna-brendel.de/images/background1.jpg" width="100px;"/><br /><sub><b>Anna Brendel</b></sub>](https://anna-brendel.de)<br />[🤔](#ideas "Ideas, Planning, & Feedback") [🌍](#translation "Translation") | [<img src="https://avatars2.githubusercontent.com/u/1560404?v=4" width="100px;"/><br /><sub><b>Givi Khojanashvili</b></sub>](https://www.linkedin.com/in/khojanashvili/)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=gigovich "Code") | [<img src="https://avatars2.githubusercontent.com/u/28822504?v=4" width="100px;"/><br /><sub><b>Chung Tran Anh</b></sub>](https://github.com/anhchungite)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=anhchungite "Code") [🌍](#translation-anhchungite "Translation") | [<img src="https://avatars0.githubusercontent.com/u/3048682?v=4" width="100px;"/><br /><sub><b>Minke Zhang</b></sub>](http://blogzhang.com)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=cripplet "Code") |
699| :---: | :---: | :---: | :---: | :---: |
700| [<img src="https://avatars1.githubusercontent.com/u/16353578?v=4" width="100px;"/><br /><sub><b>Pavel Kanyshev</b></sub>](https://github.com/aerohub)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=aerohub "Code") [🌍](#translation-aerohub "Translation") | [<img src="https://avatars3.githubusercontent.com/u/3541050?v=4" width="100px;"/><br /><sub><b>Marcel Kraus</b></sub>](https://www.marcelkraus.de)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=marcelkraus "Code") | [<img src="https://avatars2.githubusercontent.com/u/280825?v=4" width="100px;"/><br /><sub><b>Nick Busey</b></sub>](http://nickbusey.com/)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=NickBusey "Code") | [<img src="https://avatars1.githubusercontent.com/u/4789253?v=4" width="100px;"/><br /><sub><b>lkorzen</b></sub>](https://github.com/lkorzen)<br />[🌍](#translation-lkorzen "Translation") | [<img src="https://avatars1.githubusercontent.com/u/12019608?v=4" width="100px;"/><br /><sub><b>Chris Stayte</b></sub>](http://www.chrisstayte.com)<br />[🐛](https://github.com/Lednerb/bilberry-hugo-theme/issues?q=author%3AChrisStayte "Bug reports") |
701| [<img src="https://avatars0.githubusercontent.com/u/405277?v=4" width="100px;"/><br /><sub><b>Dmitry Matrosov</b></sub>](https://twitter.com/amidos_me)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=meAmidos "Code") | [<img src="https://avatars2.githubusercontent.com/u/8802277?v=4" width="100px;"/><br /><sub><b>Marc-Antoine</b></sub>](https://marca.finch4.xyz/)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=Embraser01 "Code") [🐛](https://github.com/Lednerb/bilberry-hugo-theme/issues?q=author%3AEmbraser01 "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/2030983?v=4" width="100px;"/><br /><sub><b>Nina Zakharenko</b></sub>](http://nnja.io)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=nnja "Code") [🐛](https://github.com/Lednerb/bilberry-hugo-theme/issues?q=author%3Annja "Bug reports") [📖](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=nnja "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/7719018?v=4" width="100px;"/><br /><sub><b>Nisarga</b></sub>](https://github.com/nisargap)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=nisargap "Code") | [<img src="https://avatars2.githubusercontent.com/u/2817480?v=4" width="100px;"/><br /><sub><b>Pablo Domingo Rojo</b></sub>](https://github.com/pdoro)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=pdoro "Code") |
702| [<img src="https://avatars3.githubusercontent.com/u/4433144?v=4" width="100px;"/><br /><sub><b>Rob Baruch</b></sub>](https://github.com/rabarar)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=rabarar "Code") | [<img src="https://avatars0.githubusercontent.com/u/9339576?v=4" width="100px;"/><br /><sub><b>Taoshi</b></sub>](https://github.com/GMpet)<br />[🌍](#translation-GMpet "Translation") | [<img src="https://avatars1.githubusercontent.com/u/11535575?v=4" width="100px;"/><br /><sub><b>nonumeros</b></sub>](https://github.com/nonumeros)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=nonumeros "Code") | [<img src="https://avatars3.githubusercontent.com/u/56372?v=4" width="100px;"/><br /><sub><b>Marcelo Gonçalves</b></sub>](http://marcelogoncalves.com.br)<br />[🌍](#translation-marcelocg "Translation") | [<img src="https://avatars0.githubusercontent.com/u/9111944?v=4" width="100px;"/><br /><sub><b>Dávid Sárkány</b></sub>](https://sarkanydavid.com)<br />[🌍](#translation-davidsarkany "Translation") |
703| [<img src="https://avatars3.githubusercontent.com/u/43414238?v=4" width="100px;"/><br /><sub><b>meonamz</b></sub>](https://github.com/meonamz)<br />[🌍](#translation-meonamz "Translation") | [<img src="https://avatars3.githubusercontent.com/u/32282514?v=4" width="100px;"/><br /><sub><b>Hamza Yusuf Çakır</b></sub>](https://github.com/hycakir)<br />[🌍](#translation-hycakir "Translation") | [<img src="https://avatars3.githubusercontent.com/u/15079172?s=460&v=4" width="100px;"/><br /><sub><b>Niclas Roßberger</b></sub>](https://github.com/nidomiro)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=nidomiro "Code") [🐛](https://github.com/Lednerb/bilberry-hugo-theme/issues?q=author:nidomiro "Bug reports") [🚧](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=nidomiro "maintenance") | [<img src="https://www.kiroule.com/avatar.png" width="100px;"/><br/><sub><b>Igor Baiborodine</b></sub>](https://kiroule.com)<br />[💻](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=igor-baiborodine "Code") [🐛](https://github.com/Lednerb/bilberry-hugo-theme/issues/created_by/igor-baiborodine "Bug reports") [📖](https://github.com/Lednerb/bilberry-hugo-theme/commits?author=igor-baiborodine "Documentation")
704<!-- ALL-CONTRIBUTORS-LIST:END -->
705
706This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
707
708
709## License
710The Bilberry Hugo theme is licensed under the MIT license.
Note: See TracBrowser for help on using the repository browser.