From 18b9948f1effa94a16c70dd312c56a9835ffa038 Mon Sep 17 00:00:00 2001 From: spf13 Date: Tue, 28 Jan 2014 23:29:05 -0500 Subject: [PATCH] Using table of contents within the documentation. --- docs/content/community/contributing.md | 6 +++--- docs/content/community/contributors.md | 1 + docs/content/content/example.md | 1 + docs/content/content/sections.md | 1 + docs/content/extras/permalinks.md | 1 + docs/content/extras/urls.md | 1 + docs/content/indexes/category.md | 6 +++--- docs/content/indexes/lists.md | 6 +++--- docs/content/layout/homepage.md | 1 + docs/content/layout/rss.md | 1 + docs/content/meta/roadmap.md | 1 + docs/content/overview/configuration.md | 1 + docs/content/overview/source-directory.md | 1 + docs/content/overview/usage.md | 1 + docs/layouts/_default/single.html | 6 ++++++ docs/layouts/chrome/footer.html | 14 ++++++++++++++ docs/static/static/css/styles.css | 19 +++++++++++++++++++ 17 files changed, 59 insertions(+), 9 deletions(-) diff --git a/docs/content/community/contributing.md b/docs/content/community/contributing.md index 073f28620..1de03b48d 100644 --- a/docs/content/community/contributing.md +++ b/docs/content/community/contributing.md @@ -31,7 +31,7 @@ When you're ready to create a pull request, be sure to: # Building from source -### Clone locally (for contributors): +## Clone locally (for contributors): git clone https://github.com/spf13/hugo cd hugo @@ -44,13 +44,13 @@ of the following paths: * ln -s /path/to/your/hugo $GOPATH/src/github.com/spf13/hugo * ln -s /path/to/your/hugo $GOROOT/src/pkg/github.com/spf13/hugo -### Running Hugo +## Running Hugo cd /path/to/hugo go install github.com/spf13/hugo/hugolibs go run main.go -### Building Hugo +## Building Hugo cd /path/to/hugo go build -o hugo main.go diff --git a/docs/content/community/contributors.md b/docs/content/community/contributors.md index 75e185ea5..0f5f9470e 100644 --- a/docs/content/community/contributors.md +++ b/docs/content/community/contributors.md @@ -4,6 +4,7 @@ date: "2013-07-01" aliases: ["/doc/contributors/", "/meta/contributors/"] groups: ["community"] groups_weight: 40 +notoc: true --- Hugo was built with love and golang by: diff --git a/docs/content/content/example.md b/docs/content/content/example.md index 01300d45c..d062150e5 100644 --- a/docs/content/content/example.md +++ b/docs/content/content/example.md @@ -5,6 +5,7 @@ aliases: ["/doc/example/"] linktitle: "Example" groups: ['content'] groups_weight: 50 +notoc: true --- Somethings are better shown than explained. The following is a very basic example of a content file: diff --git a/docs/content/content/sections.md b/docs/content/content/sections.md index a2fc155fa..dfda7f27e 100644 --- a/docs/content/content/sections.md +++ b/docs/content/content/sections.md @@ -3,6 +3,7 @@ title: "Sections" date: "2013-07-01" groups: ['content'] groups_weight: 20 +notoc: true --- Hugo thinks that you organize your content with a purpose. The same structure diff --git a/docs/content/extras/permalinks.md b/docs/content/extras/permalinks.md index e76b224d3..08e7f3e2d 100644 --- a/docs/content/extras/permalinks.md +++ b/docs/content/extras/permalinks.md @@ -5,6 +5,7 @@ aliases: - "/doc/permalinks/" groups: ["extras"] groups_weight: 30 +notoc: true --- By default, content is laid out into the target `publishdir` (public) diff --git a/docs/content/extras/urls.md b/docs/content/extras/urls.md index b386effba..69bc98ffc 100644 --- a/docs/content/extras/urls.md +++ b/docs/content/extras/urls.md @@ -5,6 +5,7 @@ aliases: - "/doc/urls/" groups: ["extras"] groups_weight: 40 +notoc: true --- By default, all relative URLs encountered in the input will be canonicalized using `baseurl`, so that a link `/css/foo.css` becomes diff --git a/docs/content/indexes/category.md b/docs/content/indexes/category.md index bfedde572..45a5e9b00 100644 --- a/docs/content/indexes/category.md +++ b/docs/content/indexes/category.md @@ -9,7 +9,7 @@ groups_weight: 60 This page demonstrates what would be required to add a new index called "categories" to your site. -### config.yaml +## config.yaml First step is to define the index in your config file. *Because we use both the singular and plural name of the index in our rendering it's important to provide both here. We require this, rather than using inflection in @@ -24,7 +24,7 @@ title: "Steve Francia is spf13.com" --- {{% /highlight %}} -### /layouts/indexes/category.html +## /layouts/indexes/category.html For each index type a template needs to be provided to render the index page. In the case of categories, this will render the content for /categories/`CATEGORYNAME`/. @@ -46,7 +46,7 @@ In the case of categories, this will render the content for /categories/`CATEGOR {{% /highlight %}} -### Assigning indexes to content +## Assigning indexes to content Make sure that the index is set in the front matter: diff --git a/docs/content/indexes/lists.md b/docs/content/indexes/lists.md index 552c71fa9..d5d9449ac 100644 --- a/docs/content/indexes/lists.md +++ b/docs/content/indexes/lists.md @@ -22,7 +22,7 @@ Hugo can order the meta data in two different ways. It can be ordered by the number of content assigned to that key or alphabetically. -### Example indexes.html file (alphabetical) +## Example indexes.html file (alphabetical) {{% highlight html %}} {{ template "chrome/header.html" . }} @@ -42,7 +42,7 @@ number of content assigned to that key or alphabetically. {{ template "chrome/footer.html" }} {{% /highlight %}} -### Example indexes.html file (ordered) +## Example indexes.html file (ordered) {{% highlight html %}} {{ template "chrome/header.html" . }} @@ -63,7 +63,7 @@ number of content assigned to that key or alphabetically. {{ template "chrome/footer.html" }} {{% /highlight %}} -### Variables available to list of indexes pages. +## Variables available to list of indexes pages. **.Title** The title for the content.
**.Date** The date the content is published on.
diff --git a/docs/content/layout/homepage.md b/docs/content/layout/homepage.md index c3c0f9b7a..b94f4aa1c 100644 --- a/docs/content/layout/homepage.md +++ b/docs/content/layout/homepage.md @@ -3,6 +3,7 @@ title: "Homepage Templates" date: "2013-07-01" groups: ["layout"] groups_weight: 30 +notoc: true --- Home pages are of the type "node" and have all the [node diff --git a/docs/content/layout/rss.md b/docs/content/layout/rss.md index ea6042c37..e4ab29e61 100644 --- a/docs/content/layout/rss.md +++ b/docs/content/layout/rss.md @@ -3,6 +3,7 @@ title: "RSS (feed) Templates" date: "2013-07-01" groups: ["layout"] groups_weight: 40 +notoc: "one" --- A single RSS template is used to generate all of the RSS content for the entire diff --git a/docs/content/meta/roadmap.md b/docs/content/meta/roadmap.md index fb7cba7b9..4e474279b 100644 --- a/docs/content/meta/roadmap.md +++ b/docs/content/meta/roadmap.md @@ -4,6 +4,7 @@ date: "2013-07-01" aliases: ["/doc/roadmap/"] groups: ["meta"] groups_weight: 20 +notoc: true --- In no particular order, here is what we are working on: diff --git a/docs/content/overview/configuration.md b/docs/content/overview/configuration.md index 30a33a7c7..b41b556b8 100644 --- a/docs/content/overview/configuration.md +++ b/docs/content/overview/configuration.md @@ -5,6 +5,7 @@ aliases: ["/doc/configuration/"] groups: ['gettingStarted'] linktitle: "Configuration" groups_weight: 40 +notoc: true --- The directory structure and templates provide the majority of the diff --git a/docs/content/overview/source-directory.md b/docs/content/overview/source-directory.md index 88712a10a..93df65136 100644 --- a/docs/content/overview/source-directory.md +++ b/docs/content/overview/source-directory.md @@ -4,6 +4,7 @@ date: "2013-07-01" aliases: ["/doc/source-directory/"] groups: ['gettingStarted'] groups_weight: 50 +notoc: true --- Hugo takes a single directory and uses it as the input for creating a complete website. diff --git a/docs/content/overview/usage.md b/docs/content/overview/usage.md index 23144b80b..9cfa4e66f 100644 --- a/docs/content/overview/usage.md +++ b/docs/content/overview/usage.md @@ -4,6 +4,7 @@ date: "2013-07-01" aliases: ["/doc/usage/"] groups: ['gettingStarted'] groups_weight: 30 +notoc: true --- Make sure either hugo is in your path or provide a path to it. diff --git a/docs/layouts/_default/single.html b/docs/layouts/_default/single.html index 5e42b2a09..c37b28837 100644 --- a/docs/layouts/_default/single.html +++ b/docs/layouts/_default/single.html @@ -1,4 +1,10 @@ {{ template "chrome/header.html" . }} + {{ if .Params.notoc }} + {{ else }} +
+ {{ .TableOfContents }} +
+ {{ end }}

{{ .Title }}

{{ .Content }} {{ template "chrome/footer.html" . }} diff --git a/docs/layouts/chrome/footer.html b/docs/layouts/chrome/footer.html index cfdedfc70..de3b067c9 100644 --- a/docs/layouts/chrome/footer.html +++ b/docs/layouts/chrome/footer.html @@ -12,7 +12,21 @@ + + {{ template "chrome/analytics.html" . }} + diff --git a/docs/static/static/css/styles.css b/docs/static/static/css/styles.css index cf382bbfe..c02f584ef 100755 --- a/docs/static/static/css/styles.css +++ b/docs/static/static/css/styles.css @@ -113,6 +113,25 @@ nav.navbar { background-color: #fdfdfb !important; } +#toc { + float: right; + margin-left: 1em; + padding: 1em; +} + +#TableOfContents > ul { + margin-left: -1em; + padding: 0; +} + +#TableOfContents>ul>li { + list-style: none outside none; +} + +#TableOfContents > ul > li > a { + padding-left: 1em; +} + #main table{width:100%;margin-bottom:20px;}#main table thead>tr>th,#main table tbody>tr>th,#main table tfoot>tr>th,#main table thead>tr>td,#main table tbody>tr>td,#main table tfoot>tr>td{padding:8px;line-height:1.428571429;vertical-align:top;border-top:1px solid #dddddd;} #main table thead>tr>th{vertical-align:bottom;border-bottom:2px solid #dddddd;} #main table caption+thead tr:first-child th,#main table colgroup+thead tr:first-child th,#main table thead:first-child tr:first-child th,#main table caption+thead tr:first-child td,#main table colgroup+thead tr:first-child td,#main table thead:first-child tr:first-child td{border-top:0;}