|
@@ -0,0 +1,222 @@
|
|
1
|
+---
|
|
2
|
+date: 2016-04-23T15:57:19+02:00
|
|
3
|
+menu: "main"
|
|
4
|
+title: Getting Started
|
|
5
|
+weight: 10
|
|
6
|
+---
|
|
7
|
+
|
|
8
|
+## Installation
|
|
9
|
+
|
|
10
|
+### Install Hugo
|
|
11
|
+
|
|
12
|
+Hugo itself is just a single binary without dependencies on expensive runtimes like Ruby, Python or PHP and without dependencies on any databases.
|
|
13
|
+
|
|
14
|
+{{< admonition title="Note" type="note" >}}
|
|
15
|
+Currently, this theme makes use of features that will be part of the Hugo v0.16 release. You have to [compile](https://github.com/spf13/hugo/#clone-the-hugo-project-contributor) the latest developement version yourself.
|
|
16
|
+{{< /admonition >}}
|
|
17
|
+
|
|
18
|
+<!--You just need to download the [latest version](https://github.com/spf13/hugo/releases). For more information read the official [installation guides](http://gohugo.io/overview/installing/). -->
|
|
19
|
+
|
|
20
|
+Let's make sure Hugo is set up as expected. You should see a similar version number in your terminal:
|
|
21
|
+
|
|
22
|
+```sh
|
|
23
|
+hugo version
|
|
24
|
+# Hugo Static Site Generator v0.15 BuildDate: 2016-01-03T12:47:47+01:00
|
|
25
|
+```
|
|
26
|
+
|
|
27
|
+### Install Alabaster
|
|
28
|
+
|
|
29
|
+Next, assuming you have Hugo up and running the `hugo-alabaster` theme can be installed with `git`:
|
|
30
|
+
|
|
31
|
+```sh
|
|
32
|
+# create a new Hugo website
|
|
33
|
+hugo new site my-awesome-docs
|
|
34
|
+
|
|
35
|
+# move into the themes folder of your website
|
|
36
|
+cd my-awesome-docs/themes/
|
|
37
|
+
|
|
38
|
+# download the theme
|
|
39
|
+git clone git@github.com:digitalcraftsman/hugo-alabaster-theme.git
|
|
40
|
+```
|
|
41
|
+
|
|
42
|
+## Setup
|
|
43
|
+
|
|
44
|
+Next, take a look in the `exampleSite` folder at `themes/hugo-alabaster-theme/`. This directory contains an example config file and the content that you are currently reading. It serves as an example setup for your documentation.
|
|
45
|
+
|
|
46
|
+Copy at least the `config.toml` in the root directory of your website. Overwrite the existing config file if necessary.
|
|
47
|
+
|
|
48
|
+Hugo includes a development server, so you can view your changes as you go -
|
|
49
|
+very handy. Spin it up with the following command:
|
|
50
|
+
|
|
51
|
+```sh
|
|
52
|
+hugo server
|
|
53
|
+```
|
|
54
|
+
|
|
55
|
+Now you can go to [localhost:1313](http://localhost:1313) and the Alabaster
|
|
56
|
+theme should be visible. You can now start writing your documentation, or read
|
|
57
|
+on and customize the theme through some options.
|
|
58
|
+
|
|
59
|
+## Configuration
|
|
60
|
+
|
|
61
|
+Before you are able to deploy your documentation you should take a few minute to adjust some information in the `config.toml`. Open the file in an editor:
|
|
62
|
+
|
|
63
|
+```toml
|
|
64
|
+baseurl = "http://replace-this-with-your-hugo-site.com/"
|
|
65
|
+languageCode = "en-us"
|
|
66
|
+title = "Alabaster"
|
|
67
|
+
|
|
68
|
+disqusShortname = ""
|
|
69
|
+googleAnalytics = ""
|
|
70
|
+
|
|
71
|
+[params]
|
|
72
|
+ name = "Alabaster"
|
|
73
|
+ description = "A documentation theme for Hugo."
|
|
74
|
+```
|
|
75
|
+
|
|
76
|
+Add some metadata about your theme. The `name` and `description` will appear in the top left of the sidebar. Furthermore, you can enable tracking via Google Analytics by entering your tracking code.
|
|
77
|
+
|
|
78
|
+To allow users direct feedback to your documentation you can also enable a comment section powered by Disqus. The comment section will appear on each page except the homepage.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+## Options
|
|
82
|
+
|
|
83
|
+### Adding a custom favicon
|
|
84
|
+
|
|
85
|
+Favicons are small small icons that are displayed in the tabs right next to the title of the current page. As with the logo above you need to save your favicon in `static/` and link it relative to this folder in the config file:
|
|
86
|
+
|
|
87
|
+```toml
|
|
88
|
+[params]
|
|
89
|
+ favicon = "favicon.ico"
|
|
90
|
+```
|
|
91
|
+
|
|
92
|
+### Syntax highlighting
|
|
93
|
+
|
|
94
|
+This theme uses the popular [Highlight.js](https://highlightjs.org/) library to colorize code examples. The default theme is called "Foundation" with a few small tweaks. You can link our own theme if you like. Again, store your stylesheet in the `static/` folder and set the relative path in the config file:
|
|
95
|
+
|
|
96
|
+```toml
|
|
97
|
+[params]
|
|
98
|
+ # Syntax highlighting theme
|
|
99
|
+ highlightjs = "path/to/theme.css"
|
|
100
|
+```
|
|
101
|
+
|
|
102
|
+Alternatively, you can use Pygments to highlight code blocks. If `highlightjs` does not contain a path it defaults to the Pygments stylesheet. Read the [Hugo docs](https://gohugo.io/extras/highlighting#pygments) for more information.
|
|
103
|
+
|
|
104
|
+If you used GitHub flavoured Markdown with code fences like below
|
|
105
|
+
|
|
106
|
+````
|
|
107
|
+```toml
|
|
108
|
+[params]
|
|
109
|
+ # Syntax highlighting theme
|
|
110
|
+ highlightjs = "path/to/theme.css"
|
|
111
|
+```
|
|
112
|
+````
|
|
113
|
+
|
|
114
|
+you have to add the `pygmentsuseclasses = true` option to the config file.
|
|
115
|
+
|
|
116
|
+### Small tweaks
|
|
117
|
+
|
|
118
|
+This theme provides a simple way for making small adjustments, that is changing some margins, centering text, etc. Simply put the CSS and Javascript files that contain your adjustments in the `static/` directory (ideally in subdirectories of their own) and include them via the `custom_css` and `custom_js`
|
|
119
|
+variables in your `config.toml`. Reference the files relative to `static/`:
|
|
120
|
+
|
|
121
|
+```toml
|
|
122
|
+[params]
|
|
123
|
+ custom_css = [
|
|
124
|
+ "foo.css",
|
|
125
|
+ "bar.css"
|
|
126
|
+ ]
|
|
127
|
+
|
|
128
|
+ custom_js = ["buzz.js"]
|
|
129
|
+```
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+## Sidebar
|
|
133
|
+
|
|
134
|
+### Adding a logo
|
|
135
|
+
|
|
136
|
+If your project has a logo, you can add it to the sidebar by defining the variable `logo`. Save your logo somewhere in the `static/` folder and reference the file relative to this location:
|
|
137
|
+
|
|
138
|
+```toml
|
|
139
|
+[params.sidebar]
|
|
140
|
+ logo = "images/logo.png"
|
|
141
|
+```
|
|
142
|
+
|
|
143
|
+### Adding menu entries
|
|
144
|
+
|
|
145
|
+Once you created your first content files you can link them manually in the sidebar on the left. A menu entry has the following schema:
|
|
146
|
+
|
|
147
|
+```toml
|
|
148
|
+[[menu.main]]
|
|
149
|
+ name = "Home"
|
|
150
|
+ url = "/"
|
|
151
|
+ weight = 0
|
|
152
|
+```
|
|
153
|
+
|
|
154
|
+`name` is the title displayed in the menu and `url` the relative URL to the content. The `weight` attribute allows you to modify the order of the menu entries. A menu entry appears further down the more weight you add.
|
|
155
|
+
|
|
156
|
+Instead of just linking a single file you can enhance the sidebar by creating a nested menu. This way you can list all pages of a section instead of linking them one by one (without nesting).
|
|
157
|
+
|
|
158
|
+You need extend the frontmatter of each file content file in a section slightly. The snippet below registers this content file as 'child' of a menu entry that already exists.
|
|
159
|
+
|
|
160
|
+```yaml
|
|
161
|
+menu: main
|
|
162
|
+weight: 0
|
|
163
|
+```
|
|
164
|
+
|
|
165
|
+`main` specifies to which menu the content file should be added. `main` is the only menu in this theme by default. `parent` let's you register this content file to an existing menu entry, in this case the `Home` link. Note that the parent in the frontmatter needs to match the name in `config.toml`.
|
|
166
|
+
|
|
167
|
+### Buttons
|
|
168
|
+
|
|
169
|
+Above the menu you can include multiple buttons, e.g. the number of stars on GitHub or the current build status of [TravisCI](https://travis-ci.org/).
|
|
170
|
+
|
|
171
|
+{{< admonition title="Note" type="note" >}}
|
|
172
|
+It is required that you add your username and the URL to the project you want to document. Otherwise the buttons will not be able to display any information.
|
|
173
|
+{{< /admonition >}}
|
|
174
|
+
|
|
175
|
+If your project is hosted on GitHub, add the repository link and your username to the
|
|
176
|
+configuration.
|
|
177
|
+
|
|
178
|
+```toml
|
|
179
|
+[params]
|
|
180
|
+ github_user = "digitalcraftsman"
|
|
181
|
+ github_repo = "hugo-alabaster-theme"
|
|
182
|
+ github_banner = true
|
|
183
|
+```
|
|
184
|
+
|
|
185
|
+`github_banner` adds the black banner in the top right of each page and simply links to your project on GitHub.
|
|
186
|
+
|
|
187
|
+Now you can define which buttons you want to show:
|
|
188
|
+
|
|
189
|
+```toml
|
|
190
|
+[params.sidebar]
|
|
191
|
+ github_button = true
|
|
192
|
+ travis_button = false
|
|
193
|
+ codecov_button = false
|
|
194
|
+ gratipay = ""
|
|
195
|
+```
|
|
196
|
+
|
|
197
|
+1. `github_button` displays the number of stars of your repository on GitHub
|
|
198
|
+1. `travis_button` displays the current build status of your project
|
|
199
|
+1. `codecov_button` display the code coverage of your tests thanks to [CodeCov](https://codecov.io/)
|
|
200
|
+1. `gratipay` allows you to collect tips via [GratiPay](https://gratipay.com/). Enter your username after you signed up.
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+### Relations
|
|
204
|
+
|
|
205
|
+Includes links to the previous and next page in a section those exist under the menu as "Related Topics". This makes the navigation for users easier. It can be disabled if each of your website section's contain only contain a single page.
|
|
206
|
+
|
|
207
|
+```toml
|
|
208
|
+[params.sidebar]
|
|
209
|
+ show_relations = true
|
|
210
|
+```
|
|
211
|
+
|
|
212
|
+## Footer
|
|
213
|
+
|
|
214
|
+The footer is very simple. Your `copyright` notice can be formatted with Markdown. This can be handy if you want to format text slightly or you want to include a hyperlink.
|
|
215
|
+
|
|
216
|
+`show_powered_by` allows you hide the showcase of the used tools. Some promotion is always appreciated.
|
|
217
|
+
|
|
218
|
+```toml
|
|
219
|
+[params.footer]
|
|
220
|
+ copyright = "[Digitalcraftsman](https://github.com/digitalcraftsman)"
|
|
221
|
+ show_powered_by = true
|
|
222
|
+```
|