Using table of contents within the documentation.

This commit is contained in:
spf13 2014-01-28 23:29:05 -05:00
parent 1882ffabc6
commit 18b9948f1e
17 changed files with 59 additions and 9 deletions

View file

@ -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

View file

@ -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:

View file

@ -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:

View file

@ -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

View file

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

View file

@ -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

View file

@ -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:

View file

@ -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. <br>
**.Date** The date the content is published on.<br>

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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

View file

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

View file

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

View file

@ -1,4 +1,10 @@
{{ template "chrome/header.html" . }}
{{ if .Params.notoc }}
{{ else }}
<div id="toc" class="well col-md-4 col-sm-6">
{{ .TableOfContents }}
</div>
{{ end }}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ template "chrome/footer.html" . }}

View file

@ -12,7 +12,21 @@
</div>
<script src="/static/js/jquery.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script>
$(document).ready(function() {
$("nav#TableOfContents a").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top-25 + "px"
}, {
duration: 450,
});
return false;
});
});
</script>
{{ template "chrome/analytics.html" . }}
</body>
</html>

View file

@ -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;}