hugo-geekblog/exampleSite/content/posts/getting-started.md

437 lines
12 KiB
Markdown
Raw Normal View History

2020-07-18 14:12:24 +00:00
---
2020-09-12 16:04:41 +00:00
title: "Getting Started"
2020-07-18 14:12:24 +00:00
date: 2020-07-15T20:00:00+02:00
authors:
- john-doe
tags:
- Documentation
weight: 1
---
2020-09-12 16:04:41 +00:00
This post tells you how to get started with the Geekblog theme, including installation and basic configuration.
2020-07-18 14:12:24 +00:00
<!--more-->
2020-09-27 20:14:36 +00:00
[![Build Status](https://img.shields.io/drone/build/thegeeklab/hugo-geekblog?logo=drone)](https://cloud.drone.io/thegeeklab/hugo-geekblog)
2020-07-18 14:12:24 +00:00
[![Hugo Version](https://img.shields.io/badge/hugo-0.65-blue.svg)](https://gohugo.io)
2020-09-27 20:14:36 +00:00
[![GitHub release](https://img.shields.io/github/v/release/thegeeklab/hugo-geekblog)](https://github.com/thegeeklab/hugo-geekblog/releases/latest)
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/hugo-geekblog)](https://github.com/thegeeklab/hugo-geekblog/graphs/contributors)
[![License: MIT](https://img.shields.io/github/license/thegeeklab/hugo-geekblog)](https://github.com/thegeeklab/hugo-geekblog/blob/master/LICENSE)
2020-07-18 14:12:24 +00:00
2020-07-18 14:33:03 +00:00
<!-- spellchecker-disable -->
2020-09-12 16:04:41 +00:00
2020-07-18 14:12:24 +00:00
{{< toc >}}
2020-09-12 16:04:41 +00:00
2020-07-18 14:33:03 +00:00
<!-- spellchecker-enable -->
2020-07-18 14:12:24 +00:00
## Features
- Clean and simple design
- Light and mobile-friendly
- Easy customization
- Zero initial configuration
- Handy shortcodes
- Simple sticky posts
- Content tags
- Multiple authors
2020-08-24 09:42:53 +00:00
- Supports Atom and JSON feeds
2020-07-18 14:12:24 +00:00
2020-09-12 16:04:41 +00:00
## Install requirements
You need a recent version of Hugo for local builds and previews of sites that use Geekblog. As we are using [gulp](https://gulpjs.com/) as pre-processor the normal version of Hugo is sufficient. If you prefer the extended version of Hugo anyway this will work as well. For comprehensive Hugo documentation, see [gohugo.io](https://gohugo.io/documentation/).
If you want to use the theme from a cloned branch instead of a release tarball you'll need to install `gulp` locally and run the default pipeline once to create all required assets.
```Shell
# install required packages from package.json
npm install
# run gulp pipeline to build required assets
npx gulp default
2020-09-12 16:04:41 +00:00
```
## Using the theme
To prepare your new site environment just a few steps are required:
1. Create a new empty Hugo site.
```Shell
hugo new site demosite
```
2. Switch to the root of the new site.
```Shell
cd demosite
```
2020-09-12 16:20:46 +00:00
3. Install the Geekblog theme from a [release bundle](#option-1-download-pre-build-release-bundle) (recommended) or form [Git branch](#option-2-clone-the-github-repository).
2020-09-12 16:04:41 +00:00
2020-09-12 16:20:46 +00:00
4. Create the minimal required Hugo configuration `config.toml`. For all configuration options see [here](#configuration).
2020-09-12 16:04:41 +00:00
```Toml
baseURL = "http://localhost"
title = "Geekblog"
theme = "hugo-geekblog"
# Geekblog required configuration
pygmentsUseClasses = true
pygmentsCodeFences = true
disablePathToLower = true
# Needed for mermaid shortcodes
[markup]
[markup.goldmark.renderer]
unsafe = true
[markup.tableOfContents]
startLevel = 1
endLevel = 9
2020-09-12 16:34:13 +00:00
[taxonomies]
author = "authors"
tag = "tags"
series = "series"
2020-09-12 16:34:13 +00:00
[mediaTypes]
[mediaTypes."application/atom+xml"]
suffixes = ["xml"]
[outputFormats]
[outputFormats.Atom]
# https://validator.w3.org/feed/docs/atom.html#whatIsAtom
name = "Atom"
mediaType = "application/atom+xml"
# generated file = <baseName>.<mediaType."application/atom+xml".suffixes[0]> = atom.xml
baseName = "atom"
isPlainText = false
rel = "alternate"
isHTML = false
noUgly = true
permalinkable = false
[outputFormats.outputs]
home = ["HTML", "ATOM"]
page = ["HTML"]
section = ["HTML"]
taxonomy = ["HTML"]
term = ["HTML", "ATOM"]
2020-09-12 16:04:41 +00:00
```
5. Test your site.
```Shell
hugo server -D
```
2020-09-17 09:31:23 +00:00
If you want to add some demo data you could use the content from the [Hugo basic example](https://github.com/gohugoio/hugoBasicExample):
```Shell
2020-11-08 16:07:53 +00:00
curl -L https://github.com/gohugoio/hugoBasicExample/archive/master.tar.gz | tar -xz --exclude "config*" --exclude "LICENSE" --exclude "README*" --strip-components=1
2020-09-12 16:04:41 +00:00
```
### Option 1: Download pre-build release bundle
Download and extract the latest release bundle into the theme directory.
```Shell
mkdir -p themes/hugo-geekblog/
2020-09-27 20:14:36 +00:00
curl -L https://github.com/thegeeklab/hugo-geekblog/releases/latest/download/hugo-geekblog.tar.gz | tar -xz -C themes/hugo-geekblog/ --strip-components=1
2020-09-12 16:04:41 +00:00
```
### Option 2: Clone the GitHub repository
{{< hint info >}}
**Info**\
Keep in mind this method is not recommended and needs some extra steps to get it working.
If you want to use the Theme as submodule keep in mind that your build process need to
run the described steps as well.
{{< /hint >}}
Clone the Geekblog git repository.
```Shell
2020-09-27 20:14:36 +00:00
git clone https://github.com/thegeeklab/hugo-geekblog.git themes/geekblog
2020-09-12 16:04:41 +00:00
```
Build required theme assets e.g. CSS files and SVG sprites with `gulp`.
```Shell
gulp default
```
2020-07-18 14:12:24 +00:00
## Configuration
### Site configuration
{{< tabs "site-config" >}}
{{< tab "TOML" >}}
```Toml
baseURL = "http://localhost"
title = "Geekblog"
2020-07-18 14:12:24 +00:00
theme = "hugo-geekblog"
# Required to get well formatted code blocks
pygmentsUseClasses = true
pygmentsCodeFences = true
disablePathToLower = true
enableGitInfo = true
[markup]
2020-09-12 16:34:13 +00:00
[markup.goldmark.renderer]
2020-07-18 14:12:24 +00:00
unsafe = true
2020-09-12 16:34:13 +00:00
[markup.tableOfContents]
2020-07-18 14:12:24 +00:00
startLevel = 1
endLevel = 9
[taxonomies]
author = "authors"
tag = "tags"
series = "series"
2020-07-18 14:12:24 +00:00
[mediaTypes]
2020-09-12 16:34:13 +00:00
[mediaTypes."application/atom+xml"]
2020-07-18 14:12:24 +00:00
suffixes = ["xml"]
[outputFormats]
2020-09-12 16:34:13 +00:00
[outputFormats.Atom]
2020-07-18 14:12:24 +00:00
# https://validator.w3.org/feed/docs/atom.html#whatIsAtom
name = "Atom"
mediaType = "application/atom+xml"
# generated file = <baseName>.<mediaType."application/atom+xml".suffixes[0]> = atom.xml
baseName = "atom"
isPlainText = false
rel = "alternate"
isHTML = false
noUgly = true
permalinkable = false
[outputs]
home = ["HTML", "ATOM"]
page = ["HTML"]
section = ["HTML"]
taxonomy = ["HTML"]
term = ["HTML", "ATOM"]
[params]
subtitle = "Blog about my favorite topics"
description = "This is my personal blog about tech."
keywords = []
images = []
2020-07-24 20:25:04 +00:00
# (Optional, default static/brand.svg) Set the path to a logo for the Geekblog
# relative to your 'static/' folder.
logo = "logo.png"
2020-07-24 20:25:04 +00:00
2020-07-18 14:12:24 +00:00
# (Optional, default 6) Set how many table of contents levels to be showed on page.
# Use false to hide ToC, note that 0 will default to 6 (https://gohugo.io/functions/default/)
# You can also specify this parameter per page in front matter.
geekblogToC = 3
# (Optional, default none) Add a link to your Legal Notice page to the site footer.
# It can be either a remote url or a local file path relative to your content directory.
geekblogLegalNotice = "https://blog.example.com/legal"
# (Optional, default none) Add a link to your Privacy Policy page to the site footer.
# It can be either a remote url or a local file path relative to your content directory.
geekblogPrivacyPolicy = "/privacy"
# (Optional, default true) Add an anchor link to headlines.
geekblogAnchor = true
# (Optional, default true) Copy anchor url to clipboard on click.
geekblogAnchorCopy = true
2020-07-25 11:53:27 +00:00
# (Optional, default none) Sites main author.
2020-07-18 14:12:24 +00:00
geekblogAuthor = "john-doe"
2020-11-28 15:50:56 +00:00
# (Optional, default posts) Set the name of the default content section.
geekblogContentSection = "my-pages"
2020-07-18 14:12:24 +00:00
# (Optional, default none) Adds a "Hosted on <provider>" line to the footer.
# Could be used if you want to give credits to your hosting provider.
[params.geekblogHostedOn]
name = "Uberspace"
2020-07-18 14:12:24 +00:00
link = "https://uberspace.de/en/"
# (Optional, default none) Adds a "Content licensed under <license>" line to the footer.
# Could be used if you want to define a default license for your content.
[params.geekblogContentLicense]
2020-07-18 14:12:24 +00:00
name = "CC BY-SA 4.0"
link = "https://creativecommons.org/licenses/by-sa/4.0/"
```
{{< /tab >}}
{{< tab "YAML" >}}
```Yaml
---
# ...
theme: hugo-geekblog
# Required to get well formatted code blocks
pygmentsUseClasses: true
pygmentsCodeFences: true
disablePathToLower: true
enableGitInfo: true
markup:
goldmark:
renderer:
unsafe: true
tableOfContents:
startLevel: 1
endLevel: 9
taxonomies:
author: authors
tag: tags
series: series
2020-07-18 14:12:24 +00:00
mediaTypes:
"application/atom+xml":
suffixes:
- "xml"
outputFormats:
Atom:
# https://validator.w3.org/feed/docs/atom.html#whatIsAtom
name: "Atom"
mediaType: "application/atom+xml"
# generated file: <baseName>.<mediaType."application/atom+xml".suffixes[0]> = atom.xml
baseName: "atom"
isPlainText: false
rel: "alternate"
isHTML: false
noUgly: true
permalinkable: false
outputs:
home:
- HTML
- ATOM
page:
- HTML
section:
- HTML
taxonomy:
- HTML
term:
- HTML
- ATOM
2020-07-22 09:12:24 +00:00
# Required if you want to render robots.txt template
enableRobotsTXT: true
2020-07-18 14:12:24 +00:00
params:
subtitle: "Blog about my favorite topics"
description: "This is my personal blog about tech."
keywords: []
images: []
2020-07-24 20:25:04 +00:00
# (Optional, default static/brand.svg) Set the path to a logo for the Geekblog
# relative to your 'static/' folder.
logo: logo.png
2020-07-18 14:12:24 +00:00
# (Optional, default 6) Set how many table of contents levels to be showed on page.
# Use false to hide ToC, note that 0 will default to 6 (https://gohugo.io/functions/default/)
# You can also specify this parameter per page in front matter.
geekblogToC: 3
# (Optional, default none) Add a link to your Legal Notice page to the site footer.
# It can be either a remote url or a local file path relative to your content directory.
geekblogLegalNotice: https://blog.example.com/legal
# (Optional, default none) Add a link to your Privacy Policy page to the site footer.
# It can be either a remote url or a local file path relative to your content directory.
geekblogPrivacyPolicy: /privacy
# (Optional, default true) Add an anchor link to headlines.
geekblogAnchor: true
# (Optional, default true) Copy anchor url to clipboard on click.
geekblogAnchorCopy: true
2020-07-25 11:53:27 +00:00
# (Optional, default none) Sites main author.
2020-07-18 14:12:24 +00:00
geekblogAuthor: john-doe
2020-11-28 15:50:56 +00:00
# (Optional, default posts) Set the name of the default content section.
geekblogContentSection: "my-pages"
2020-07-18 14:12:24 +00:00
# (Optional, default none) Adds a "Hosted on <provider>" line to the footer.
# Could be used if you want to give credits to your hosting provider.
geekblogHostedOn:
name: Uberspace
link: https://uberspace.de/en/
# (Optional, default none) Adds a "Content licensed under <license>" line to the footer.
# Could be used if you want to define a default license for your content.
geekblogContentLicense:
name: CC BY-SA 4.0
link: https://creativecommons.org/licenses/by-sa/4.0/
```
{{< /tab >}}
{{< /tabs >}}
### Page configuration
{{< tabs "page-config" >}}
{{< tab "TOML" >}}
```Toml
# Title of your post. If not set, filename will be used.
title = My first post
# Set weigth to 1 to mark this post as sticky post.
weight = 1
# List of authors of the post.
authors = ["john-doe"]
# Tags for this post.
2020-09-12 16:04:41 +00:00
tags = ["Open Source"]
2020-07-18 14:12:24 +00:00
# Set how many table of contents levels to be showed on page.
geekblogToC = 3
# Set true to hide page or section from side menu (file-tree menu only).
geekblogHidden = true
# Add an anchor link to headlines.
geekblogAnchor = true
```
{{< /tab >}}
{{< tab "YAML" >}}
```Yaml
# Title of your post. If not set, filename will be used.
title: My first post
# Set weigth to 1 to mark this post as sticky post.
weight: 1
# List of authors of the post.
authors:
- john-doe
# Tags for this post.
tags:
- Open Source
# Set how many table of contents levels to be showed on page.
geekblogToC: 3
# Set true to hide page or section from side menu (file-tree menu only).
geekblogHidden: true
# Add an anchor link to headlines.
geekblogAnchor: true
```
{{< /tab >}}
{{< /tabs >}}