Skip to content

Commit

Permalink
Initial commit with alabaster theme
Browse files Browse the repository at this point in the history
  • Loading branch information
lerrua committed Aug 30, 2017
0 parents commit 1102f97
Show file tree
Hide file tree
Showing 9 changed files with 384 additions and 0 deletions.
6 changes: 6 additions & 0 deletions archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ .Date }}
draft: true
---

38 changes: 38 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
baseurl = "prest.github.io/"
languageCode = "en-us"
metadataformat = "yaml"
title = "pREST"
theme = "hugo-alabaster-theme"

publishDir = "docs"
disqusShortname = ""
googleAnalytics = ""

[params]
name = "pREST"
description = "A fully RESTful API from any existing PostgreSQL database."

github_user = "prest"
github_repo = "docs"
github_banner = true

custom_css = []
custom_js = []

highlightjs = "css/highlight.css"
favicon = "favicon.ico"

[params.sidebar]
logo = "favicon.ico"


github_button = true
travis_button = false
codecov_button = false
gratipay = ""

show_relations = true

[params.footer]
copyright = "[Digitalcraftsman](https://github.com/digitalcraftsman)"
show_powered_by = true
62 changes: 62 additions & 0 deletions content/adding-content/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
date: 2016-04-23T20:26:34+02:00
menu: "main"
title: Adding content
weight: 20
---

## Hello world

Let's create our first content file for your documentation. Open a terminal and add the following command for each new file you want to add. Replace `<section-name>` with a general term that describes your document in detail.

```sh
hugo new <section-name>/filename.md
```

Visitors of your website will find the final document under `www.example.com/<section-name>/filename/`.

Since it's possible to have multiple content files in the same section I recommend to create at least one `index.md` file per section. This ensures that users will find an index page under `www.example.com/<section-name>`.

## Homepage

To add content to the homepage you need to add a small indicator to the frontmatter of the content file:

```toml
type: homepage
```

Otherwise the theme will not be able to find the corresponding content file.

## Table of contents

You maybe noticed that the menu on the left contains a small table of contents of the current page. All `<h2>` tags (`## Headline` in Markdown) will be added automatically.

## Admonitions

Admonition is a handy feature that adds block-styled side content to your documentation, either notes or warnings. It can be enabled by using the corresponding [shortcodes](http://gohugo.io/extras/shortcodes/) inside your content:

```md
{{</* admonition title="Note" type="note" */>}}
Something good to know.
{{</* /admonition */>}}
```

will be rendered as

{{< admonition title="Note" type="note" >}}
Lorem ipsum dolor.
{{< /admonition >}}

The `type` parameter can optionally be used to either display a `note` or `warning`. The last type is the default one.

```md
{{</* admonition title="Caution" */>}}
Don't try this at home!
{{</* /admonition */>}}
```

becomes

{{< admonition title="Caution" >}}
Don't try this at home!
{{< /admonition >}}
222 changes: 222 additions & 0 deletions content/getting-started/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
---
date: 2016-04-23T15:57:19+02:00
menu: "main"
title: Getting Started
weight: 10
---

## Installation

### Install Hugo

Hugo itself is just a single binary without dependencies on expensive runtimes like Ruby, Python or PHP and without dependencies on any databases.

{{< admonition title="Note" type="note" >}}
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.
{{< /admonition >}}

<!--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/). -->

Let's make sure Hugo is set up as expected. You should see a similar version number in your terminal:

```sh
hugo version
# Hugo Static Site Generator v0.15 BuildDate: 2016-01-03T12:47:47+01:00
```

### Install Alabaster

Next, assuming you have Hugo up and running the `hugo-alabaster` theme can be installed with `git`:

```sh
# create a new Hugo website
hugo new site my-awesome-docs

# move into the themes folder of your website
cd my-awesome-docs/themes/

# download the theme
git clone [email protected]:digitalcraftsman/hugo-alabaster-theme.git
```

## Setup

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.

Copy at least the `config.toml` in the root directory of your website. Overwrite the existing config file if necessary.

Hugo includes a development server, so you can view your changes as you go -
very handy. Spin it up with the following command:

```sh
hugo server
```

Now you can go to [localhost:1313](http://localhost:1313) and the Alabaster
theme should be visible. You can now start writing your documentation, or read
on and customize the theme through some options.

## Configuration

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:

```toml
baseurl = "http://replace-this-with-your-hugo-site.com/"
languageCode = "en-us"
title = "Alabaster"

disqusShortname = ""
googleAnalytics = ""

[params]
name = "Alabaster"
description = "A documentation theme for Hugo."
```

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.

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.


## Options

### Adding a custom favicon

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:

```toml
[params]
favicon = "favicon.ico"
```

### Syntax highlighting

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:

```toml
[params]
# Syntax highlighting theme
highlightjs = "path/to/theme.css"
```

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.

If you used GitHub flavoured Markdown with code fences like below

````
```toml
[params]
# Syntax highlighting theme
highlightjs = "path/to/theme.css"
```
````

you have to add the `pygmentsuseclasses = true` option to the config file.

### Small tweaks

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`
variables in your `config.toml`. Reference the files relative to `static/`:

```toml
[params]
custom_css = [
"foo.css",
"bar.css"
]

custom_js = ["buzz.js"]
```


## Sidebar

### Adding a logo

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:

```toml
[params.sidebar]
logo = "images/logo.png"
```

### Adding menu entries

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:

```toml
[[menu.main]]
name = "Home"
url = "/"
weight = 0
```

`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.

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).

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.

```yaml
menu: main
weight: 0
```
`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`.

### Buttons

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/).

{{< admonition title="Note" type="note" >}}
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.
{{< /admonition >}}

If your project is hosted on GitHub, add the repository link and your username to the
configuration.

```toml
[params]
github_user = "digitalcraftsman"
github_repo = "hugo-alabaster-theme"
github_banner = true
```

`github_banner` adds the black banner in the top right of each page and simply links to your project on GitHub.

Now you can define which buttons you want to show:

```toml
[params.sidebar]
github_button = true
travis_button = false
codecov_button = false
gratipay = ""
```

1. `github_button` displays the number of stars of your repository on GitHub
1. `travis_button` displays the current build status of your project
1. `codecov_button` display the code coverage of your tests thanks to [CodeCov](https://codecov.io/)
1. `gratipay` allows you to collect tips via [GratiPay](https://gratipay.com/). Enter your username after you signed up.


### Relations

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.

```toml
[params.sidebar]
show_relations = true
```

## Footer

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.

`show_powered_by` allows you hide the showcase of the used tools. Some promotion is always appreciated.

```toml
[params.footer]
copyright = "[Digitalcraftsman](https://github.com/digitalcraftsman)"
show_powered_by = true
```
21 changes: 21 additions & 0 deletions content/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
date: 2016-04-23T15:21:22+02:00
title: Foreword
type: homepage
menu: main
weight: 0
---

## What is Alabaster?

[Alabaster](https://github.com/bitprophet/alabaster) was originally a theme for the popular documentation tool [Sphinx](http://www.sphinx-doc.org/en/stable/). This theme port to Hugo theme is all about documentations. It should allow you to easily create a documentation for your projects.

[Fabric](http://www.fabfile.org/) and [Invoke](http://www.pyinvoke.org/) are two examples of the Alabaster theme in the wild.

The following pages will guide you through the setup, introduce you to the very basics of [Hugo](https://gohugo.io) and show you the capabilities of this theme. Have a look at the [Roadmap]({{< relref "roadmap/index.md" >}}) if you're curious about what comes next.

## Acknowledgements

Last but not I want to give a big shout-out to [Jeff Forcier](https://github.com/bitprophet), [Kenneth Reitz](https://github.com/kennethreitz) and [Armin Ronacher](https://github.com/mitsuhiko). Their work and modifications on the original codebase made this port possible.

Furthermore, thanks to [Steve Francia](https://gihub.com/spf13) for creating Hugo and the [awesome community](https://github.com/spf13/hugo/graphs/contributors) around the project.
34 changes: 34 additions & 0 deletions content/roadmap/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
date: 2016-04-23T20:08:11+01:00
title: Roadmap
menu: main
weight: 30
---

Quo vadis? The port of the original [Alabaster theme](https://github.com/bitprophet/alabaster) has replicated nearly all of its features. A few are still missing, but I've good news: the Hugo community is actively working on this issues. Maybe with the next release of Hugo we can abandon this list. Stay tuned.

## Planned features

### Localization

Currently, it is possible to collect all strings in a single place for easy customization. However, this only enables you to define all strings in a single language. This approach is quite limiting in terms of localization support. Therefore, I decided to wait for a native integration. This way we can avoid a second setup of all strings in your website.

Keep an eye on [#1734](https://github.com/spf13/hugo/issues/1734).

### Search

Beside third-party services, some hacky workarounds and Grunt-/Gulp-based scripts that only require unnecessary dependencies, future versions of Hugo will support the generation of a content index as a core feature.

Keep an eye on [#1853](https://github.com/spf13/hugo/pull/1853).

### Styling options

The original theme allowed users to customize the layout directly from the [configuration](https://github.com/bitprophet/alabaster#style-colors). There is a similar idea that tries to template CSS stylesheets - this means every stylesheet would be treat as a template that can access the values from your config file.

Keep an eye on [#1431](https://github.com/spf13/hugo/pull/1431).

## Contributing

Did you found an bug or you would like to suggest a new feature? I'm open for feedback. Please open a new [issue](https://github.com/digitalcraftsman/hugo-alabaster-theme/issues) and let me know what you think.

You're also welcome to contribute with [pull requests](https://github.com/digitalcraftsman/hugo-alabaster-theme/pulls).
Empty file added layouts/.gitkeep
Empty file.
Empty file added static/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions themes/hugo-alabaster-theme
Submodule hugo-alabaster-theme added at 3510ef

0 comments on commit 1102f97

Please sign in to comment.