ref: 18b9948f1effa94a16c70dd312c56a9835ffa038
parent: 1882ffabc603a1a5a81b536157610dbbb4e1bd6a
author: spf13 <[email protected]>
date: Tue Jan 28 18:29:05 EST 2014
Using table of contents within the documentation.
--- a/docs/content/community/contributing.md
+++ b/docs/content/community/contributing.md
@@ -31,7 +31,7 @@
# Building from source
-### Clone locally (for contributors):
+## Clone locally (for contributors):
git clone https://github.com/spf13/hugo
cd hugo
@@ -44,13 +44,13 @@
* 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
--- a/docs/content/community/contributors.md
+++ b/docs/content/community/contributors.md
@@ -4,6 +4,7 @@
aliases: ["/doc/contributors/", "/meta/contributors/"]
groups: ["community"]
groups_weight: 40
+notoc: true
---
Hugo was built with love and golang by:
--- a/docs/content/content/example.md
+++ b/docs/content/content/example.md
@@ -5,6 +5,7 @@
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:
--- a/docs/content/content/sections.md
+++ b/docs/content/content/sections.md
@@ -3,6 +3,7 @@
date: "2013-07-01"
groups: ['content']
groups_weight: 20
+notoc: true
---
Hugo thinks that you organize your content with a purpose. The same structure
binary files a/docs/content/extras/permalinks.md b/docs/content/extras/permalinks.md differ
--- a/docs/content/extras/urls.md
+++ b/docs/content/extras/urls.md
@@ -5,6 +5,7 @@
- "/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
--- a/docs/content/indexes/category.md
+++ b/docs/content/indexes/category.md
@@ -9,7 +9,7 @@
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 @@
---
{{% /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 @@
{{% /highlight %}}
-### Assigning indexes to content
+## Assigning indexes to content
Make sure that the index is set in the front matter:
--- a/docs/content/indexes/lists.md
+++ b/docs/content/indexes/lists.md
@@ -22,7 +22,7 @@
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 @@
{{ 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 @@
{{ 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>
--- a/docs/content/layout/homepage.md
+++ b/docs/content/layout/homepage.md
@@ -3,6 +3,7 @@
date: "2013-07-01"
groups: ["layout"]
groups_weight: 30
+notoc: true
---
Home pages are of the type "node" and have all the [node
--- a/docs/content/layout/rss.md
+++ b/docs/content/layout/rss.md
@@ -3,6 +3,7 @@
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
--- a/docs/content/meta/roadmap.md
+++ b/docs/content/meta/roadmap.md
@@ -4,6 +4,7 @@
aliases: ["/doc/roadmap/"]
groups: ["meta"]
groups_weight: 20
+notoc: true
---
In no particular order, here is what we are working on:
--- a/docs/content/overview/configuration.md
+++ b/docs/content/overview/configuration.md
@@ -5,6 +5,7 @@
groups: ['gettingStarted']
linktitle: "Configuration"
groups_weight: 40
+notoc: true
---
The directory structure and templates provide the majority of the
--- a/docs/content/overview/source-directory.md
+++ b/docs/content/overview/source-directory.md
@@ -4,6 +4,7 @@
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.
--- a/docs/content/overview/usage.md
+++ b/docs/content/overview/usage.md
@@ -4,6 +4,7 @@
aliases: ["/doc/usage/"]
groups: ['gettingStarted']
groups_weight: 30
+notoc: true
---
Make sure either hugo is in your path or provide a path to it.
--- a/docs/layouts/_default/single.html
+++ b/docs/layouts/_default/single.html
@@ -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" . }}
--- a/docs/layouts/chrome/footer.html
+++ b/docs/layouts/chrome/footer.html
@@ -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>
--- a/docs/static/static/css/styles.css
+++ b/docs/static/static/css/styles.css
@@ -113,6 +113,25 @@
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;}