Renaming indexes to taxonomies in docs

This commit is contained in:
spf13 2014-05-15 09:57:36 -04:00
parent a4a1e39a51
commit b198cb26ba
6 changed files with 145 additions and 175 deletions

View file

@ -15,21 +15,18 @@ First step is to define the index in your config file.
important to provide both here. We require this, rather than using inflection in
effort to support as many languages as possible.*
{{% highlight yaml %}}
---
indexes:
category: "categories"
baseurl: "http://spf13.com/"
title: "Steve Francia is spf13.com"
---
{{% /highlight %}}
## /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`/.
{{% highlight html %}}
{{ template "chrome/header.html" . }}
{{ template "chrome/subheader.html" . }}
@ -43,14 +40,11 @@ In the case of categories, this will render the content for /categories/`CATEGOR
</section>
{{ template "chrome/footer.html" }}
{{% /highlight %}}
## Assigning indexes to content
Make sure that the index is set in the front matter:
{{% highlight json %}}
{
"title": "Hugo: A fast and flexible static site generator",
"categories": [
@ -60,5 +54,4 @@ Make sure that the index is set in the front matter:
],
"slug": "hugo"
}
{{% /highlight %}}

View file

@ -21,13 +21,11 @@ each content piece are located in the usual place
### Example
{{% highlight html %}}
<ul id="tags">
{{ range .Params.tags }}
<li><a href="tags/{{ . | urlize }}">{{ . }}</a> </li>
{{ end }}
</ul>
{{% /highlight %}}
## Rendering a Site's Indexes
@ -40,13 +38,11 @@ The following example displays all tag keys:
### Example
{{% highlight html %}}
<ul id="all-tags">
{{ range .Site.Indexes.tags }}
<li><a href="/tags/{{ .Name | urlize }}">{{ .Name }}</a></li>
{{ end }}
</ul>
{{% /highlight %}}
## Creating a menu based on indexes
@ -63,7 +59,6 @@ called menu.html, then include it using the
### Example complete menu.html file
This example will list all indexes, each of their keys and all the content assigned to each key.
{{% highlight html %}}
<section id="menu">
<ul>
{{ range $indexname, $index := .Site.Indexes }}
@ -82,13 +77,11 @@ This example will list all indexes, each of their keys and all the content assig
{{ end }}
</ul>
</section>
{{% /highlight %}}
### menu.html using a single index
It is more likely that you would want to use a single index for navigation.
In this example we are using the `groups` index for our menu.
{{% highlight html %}}
<section id="menu">
<ul>
{{ range $key, $index := .Site.Indexes.groups }}
@ -101,12 +94,10 @@ In this example we are using the `groups` index for our menu.
{{ end }}
</ul>
</section>
{{% /highlight %}}
### menu.html using a single index ordered by Popularity
{{% highlight html %}}
<section id="menu">
<ul>
{{ range .Site.Indexes.groups.ByCount }}
@ -119,4 +110,3 @@ In this example we are using the `groups` index for our menu.
{{ end }}
</ul>
</section>
{{% /highlight %}}

View file

@ -26,7 +26,6 @@ number of content assigned to that key or alphabetically.
## Example indexes.html file (alphabetical)
{{% highlight html %}}
{{ template "chrome/header.html" . }}
{{ template "chrome/subheader.html" . }}
@ -42,11 +41,9 @@ number of content assigned to that key or alphabetically.
</div>
</section>
{{ template "chrome/footer.html" }}
{{% /highlight %}}
## Example indexes.html file (ordered)
{{% highlight html %}}
{{ template "chrome/header.html" . }}
{{ template "chrome/subheader.html" . }}
@ -63,7 +60,6 @@ number of content assigned to that key or alphabetically.
</section>
{{ template "chrome/footer.html" }}
{{% /highlight %}}
## Variables available to list of indexes pages.

View file

@ -6,6 +6,7 @@ aliases: ["/indexes/ordering/"]
weight: 60
menu:
main:
identifier: "Ordering Taxonomies"
parent: 'taxonomy'
---
@ -20,25 +21,21 @@ Indexes can be ordered by either alphabetical key or by the number of content pi
### Order Alphabetically Example:
{{% highlight html %}}
<ul>
{{ $data := .Data }}
{{ range $key, $value := .Data.Index.Alphabetical }}
<li><a href="{{ $data.Plural }}/{{ $value.Name | urlize }}"> {{ $value.Name }} </a> {{ $value.Count }} </li>
{{ end }}
</ul>
{{% /highlight %}}
### Order by Popularity Example:
{{% highlight html %}}
<ul>
{{ $data := .Data }}
{{ range $key, $value := .Data.Index.ByCount }}
<li><a href="{{ $data.Plural }}/{{ $value.Name | urlize }}"> {{ $value.Name }} </a> {{ $value.Count }} </li>
{{ end }}
</ul>
{{% /highlight %}}
[See Also Index Lists](/indexes/lists/)

View file

@ -38,7 +38,6 @@ pluralization.
### config.yaml
{{% highlight yaml %}}
---
indexes:
tag: "tags"
@ -46,7 +45,6 @@ indexes:
baseurl: "http://spf13.com/"
title: "Steve Francia is spf13.com"
---
{{% /highlight %}}
## Assigning index values to content
@ -61,7 +59,6 @@ and assign all keys you want this content to match against.
### Example
{{% highlight json %}}
{
"title": "Hugo: A fast and flexible static site generator",
"tags": [
@ -76,5 +73,4 @@ and assign all keys you want this content to match against.
"slug": "hugo",
"project_url": "http://github.com/spf13/hugo"
}
{{% /highlight %}}

View file

@ -41,7 +41,6 @@ The following variables are available to the index template:
**.Data.`singular`** The index itself.<br>
## Example
{{% highlight html %}}
{{ template "chrome/header.html" . }}
{{ template "chrome/subheader.html" . }}
@ -55,4 +54,3 @@ The following variables are available to the index template:
</section>
{{ template "chrome/footer.html" }}
{{% /highlight %}}