diff options
author | spf13 <steve.francia@gmail.com> | 2013-08-17 08:34:25 -0400 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2013-08-17 21:54:39 -0400 |
commit | 8c0ab4def124cc632c6e046e3e770bd4a055133a (patch) | |
tree | 109ba959a87d757c37916c3c8c730be7f7875bac | |
parent | b76b80c56423ec737cb21c68602ff9eef70b14a3 (diff) |
Complete overhaul of the docs
-rw-r--r-- | docs/content/content/example.md (renamed from docs/content/doc/example.md) | 5 | ||||
-rw-r--r-- | docs/content/content/front-matter.md (renamed from docs/content/doc/front-matter.md) | 5 | ||||
-rw-r--r-- | docs/content/content/organization.md | 154 | ||||
-rw-r--r-- | docs/content/content/sections.md | 43 | ||||
-rw-r--r-- | docs/content/content/types.md | 49 | ||||
-rw-r--r-- | docs/content/doc/contributors.md | 9 | ||||
-rw-r--r-- | docs/content/doc/organization.md | 22 | ||||
-rw-r--r-- | docs/content/doc/templates.md | 66 | ||||
-rw-r--r-- | docs/content/extras/aliases.md (renamed from docs/content/doc/aliases.md) | 5 | ||||
-rw-r--r-- | docs/content/extras/indexes.md (renamed from docs/content/doc/indexes.md) | 11 | ||||
-rw-r--r-- | docs/content/extras/indexes/category.md | 54 | ||||
-rw-r--r-- | docs/content/extras/indexes/series.md | 0 | ||||
-rw-r--r-- | docs/content/extras/shortcodes.md (renamed from docs/content/doc/shortcodes.md) | 3 | ||||
-rw-r--r-- | docs/content/layout/chrome.md | 80 | ||||
-rw-r--r-- | docs/content/layout/content.md | 125 | ||||
-rw-r--r-- | docs/content/layout/go-templates.md | 15 | ||||
-rw-r--r-- | docs/content/layout/homepage.md | 50 | ||||
-rw-r--r-- | docs/content/layout/index.md | 122 | ||||
-rw-r--r-- | docs/content/layout/rss.md | 47 | ||||
-rw-r--r-- | docs/content/layout/templates.md | 35 | ||||
-rw-r--r-- | docs/content/layout/variables.md (renamed from docs/content/doc/variables.md) | 27 | ||||
-rw-r--r-- | docs/content/layout/views.md | 79 | ||||
-rw-r--r-- | docs/content/meta/contributing.md (renamed from docs/content/doc/contributing.md) | 15 | ||||
-rw-r--r-- | docs/content/meta/contributors.md | 12 | ||||
-rw-r--r-- | docs/content/meta/license.md (renamed from docs/content/doc/license.md) | 3 | ||||
-rw-r--r-- | docs/content/meta/release-notes.md (renamed from docs/content/doc/release-notes.md) | 11 | ||||
-rw-r--r-- | docs/content/meta/roadmap.md (renamed from docs/content/doc/roadmap.md) | 3 | ||||
-rw-r--r-- | docs/content/overview/configuration.md (renamed from docs/content/doc/configuration.md) | 10 | ||||
-rw-r--r-- | docs/content/overview/installing.md (renamed from docs/content/doc/installing.md) | 3 | ||||
-rw-r--r-- | docs/content/overview/source-directory.md (renamed from docs/content/doc/source-directory.md) | 3 | ||||
-rw-r--r-- | docs/content/overview/usage.md (renamed from docs/content/doc/usage.md) | 3 | ||||
-rw-r--r-- | docs/layouts/_default/single.html (renamed from docs/layouts/doc/single.html) | 0 | ||||
-rw-r--r-- | docs/layouts/chrome/header.html | 5 | ||||
-rw-r--r-- | docs/layouts/chrome/menu.html | 45 | ||||
-rw-r--r-- | docs/layouts/index.html | 3 |
35 files changed, 971 insertions, 151 deletions
diff --git a/docs/content/doc/example.md b/docs/content/content/example.md index 51e3c160e..9d90c97fa 100644 --- a/docs/content/doc/example.md +++ b/docs/content/content/example.md @@ -1,6 +1,7 @@ --- title: "Example Content File" -Pubdate: "2013-07-01" +date: "2013-07-01" +aliases: ["/doc/example/"] --- Somethings are better shown than explained. The following is a very basic example of a content file: @@ -12,7 +13,7 @@ Somethings are better shown than explained. The following is a very basic exampl Description": "" Keywords": [ "Development", "golang", "profiling" ] Tags": [ "Development", "golang", "profiling" ] - Pubdate": "2013-06-19" + date": "2013-06-19" Topics": [ "Development", "GoLang" ] Slug": "nitro" project_url": "http://github.com/spf13/nitro" diff --git a/docs/content/doc/front-matter.md b/docs/content/content/front-matter.md index 566fb1fba..0a409c56a 100644 --- a/docs/content/doc/front-matter.md +++ b/docs/content/content/front-matter.md @@ -1,6 +1,7 @@ +++ title = "Front Matter" date = "2013-07-01" +aliases = ["/doc/front-matter/"] +++ The front matter is one of the features that gives Hugo it's strength. It enables @@ -18,7 +19,7 @@ Supported formats: <br> title: "spf13-vim 3.0 release and new website" description: "spf13-vim is a cross platform distribution of vim plugins and resources for Vim." tags: [ ".vimrc", "plugins", "spf13-vim", "vim" ] - pubdate: "2012-04-06" + date: "2012-04-06" categories: - "Development" - "VIM" @@ -32,7 +33,7 @@ Supported formats: <br> title = "spf13-vim 3.0 release and new website" description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim." tags = [ ".vimrc", "plugins", "spf13-vim", "vim" ] - Pubdate = "2012-04-06" + date = "2012-04-06" categories = [ "Development", "VIM" diff --git a/docs/content/content/organization.md b/docs/content/content/organization.md new file mode 100644 index 000000000..f9eba097a --- /dev/null +++ b/docs/content/content/organization.md @@ -0,0 +1,154 @@ +--- +title: "Content Organization" +date: "2013-07-01" +aliases: ["/doc/organization/"] +--- + +Hugo uses markdown files with headers commonly called the front matter. Hugo respects the organization +that you provide for your content to minimize any extra configuration, though this can be overridden +by additional configuration in the front matter. + +## Organization +In Hugo the content should be arranged in the same way they are intended for the rendered website. +Without any additional configuration the following will just work. Hugo supports +content nested at any level. The top level is special in Hugo and is used as the +[section](/content/sections). + + . + └── content + ├── post + | ├── firstpost.md // <- http://site.com/post/firstpost/ + | ├── happy + | | └── happiness.md // <- http://site.com/happy/happiness/ + | └── secondpost.md // <- http://site.com/post/secondpost/ + └── quote + ├── first.md // <- http://site.com/quote/first/ + └── second.md // <- http://site.com/quote/second/ + +**Here's the same organization run with hugo -\-uglyurls** + + . + └── content + ├── post + | ├── firstpost.md // <- http://site.com/post/firstpost.html + | ├── happy + | | └── happiness.md // <- http://site.com/happy/happiness.html + | └── secondpost.md // <- http://site.com/post/secondpost.html + └── quote + ├── first.md // <- http://site.com/quote/first.html + └── second.md // <- http://site.com/quote/second.html + +## Destinations + +Hugo thinks that you organize your content with a purpose. The same structure +that works to organize your source content is used to organize the rendered +site. As displayed above, the organization of the source content will be +mirrored in the destination. + +There are times when one would need more control over their content. In these +cases there are a variety of things that can be specified in the front matter to +determine the destination of a specific piece of content. + +The following items are defined in order, latter items in the list will override +earlier settings. + +#### filename +This isn't in the front matter, but is the actual name of the file minus the +extension. This will be the name of the file in the destination. + +#### slug +Defined in the front matter, the slug can take the place of the filename for the +destination. + +#### filepath +The actual path to the file on disk. Destination will create the destination +with the same path. Includes [section](/content/sections). + +#### section +section can be provided in the front matter overriding the section derived from +the source content location on disk. See [section](/content/sections). + +#### path +path can be provided in the front matter. This will replace the actual +path to the file on disk. Destination will create the destination with the same +path. Includes [section](/content/sections). + +#### url +A complete url can be provided. This will override all the above as it pertains +to the end destination. This must be the path from the baseurl (starting with a "/"). +When a url is provided it will be used exactly. Using url will ignore the +-\-uglyurls setting. + + +## Path breakdown in hugo + +### Content + + . path slug + . ⊢-------^----⊣ ⊢------^-------⊣ + content/extras/indexes/category-example/index.html + + + . section slug + . ⊢--^--⊣ ⊢------^-------⊣ + content/extras/indexes/category-example/index.html + + + . section slug + . ⊢--^--⊣⊢--^--⊣ + content/extras/indexes/index.html + +### Destination + + + permalink + ⊢--------------^-------------⊣ + http://spf13.com/projects/hugo + + + baseUrl section slug + ⊢-----^--------⊣ ⊢--^---⊣ ⊢-^⊣ + http://spf13.com/projects/hugo + + + baseUrl section slug + ⊢-----^--------⊣ ⊢--^--⊣ ⊢--^--⊣ + http://spf13.com/extras/indexes/example + + + baseUrl path slug + ⊢-----^--------⊣ ⊢------^-----⊣ ⊢--^--⊣ + http://spf13.com/extras/indexes/example + + + baseUrl url + ⊢-----^--------⊣ ⊢-----^-----⊣ + http://spf13.com/projects/hugo + + + baseUrl url + ⊢-----^--------⊣ ⊢--------^-----------⊣ + http://spf13.com/extras/indexes/example + + + +section = which type the content is by default + based on content location + front matter overrides + + +slug = name.ext or name/ + based on content-name.md + front matter overrides + + +path = section + path to file exluding slug + based on path to content location + + +url = relative url + defined in front matter + overrides all the above + + + diff --git a/docs/content/content/sections.md b/docs/content/content/sections.md new file mode 100644 index 000000000..ca72d6109 --- /dev/null +++ b/docs/content/content/sections.md @@ -0,0 +1,43 @@ +--- +title: "Sections" +date: "2013-07-01" +--- + +Hugo thinks that you organize your content with a purpose. The same structure +that works to organize your source content is used to organize the rendered +site ( [see organization](/content/organization) ). Following this pattern Hugo +uses the top level of your content organization as **the Section**. + +The following example site uses two sections, "post" and "quote". + + . + └── content + ├── post + | ├── firstpost.md // <- http://site.com/post/firstpost/ + | ├── happy + | | └── happiness.md // <- http://site.com/happy/happiness/ + | └── secondpost.md // <- http://site.com/post/secondpost/ + └── quote + ├── first.md // <- http://site.com/quote/first/ + └── second.md // <- http://site.com/quote/second/ + + +*Regardless of location on disk, the section can be provided in the front matter +which will affect the destination location*. + +## Sections and Types + +By default everything created within a section will use the content type +that matches the section name. + +Section defined in the front matter have the same impact. + +To change the type of a given piece of content simply define the type +in the front matter. + +If a layout for a given type hasn't been provided a default type template will +be used instead provided is exists. + + + + diff --git a/docs/content/content/types.md b/docs/content/content/types.md new file mode 100644 index 000000000..8f535454c --- /dev/null +++ b/docs/content/content/types.md @@ -0,0 +1,49 @@ +--- +title: "Content Types" +date: "2013-07-01" +--- + +Hugo has full support for multiple content types each with it's own set +of meta data and template. A good example of when multiple types are +needed is to look a tumblr. A piece of content could be a photo, quote +or post, each with different meta data and rendered differently. + + +## Defining a content type + +Creating a new content type is easy in Hugo. You simply provide the +templates that the new type will use. + +It is essential to provide the single render view template as well as a +list view template. + +**Step 1:** +Create a directory with the name of the type in layouts.Type is always singular. *Eg /layouts/post*. + +**Step 2:** +Create a file called single.html inside your directory. *Eg /layouts/post/single.html*. + +**Step 3:** +Create a file with the same name as your directory in /layouts/indexes/. *Eg /layouts/index/post.html*. + +**Step 4:** +Many sites support rendering content in a few different ways, for +instance a single page view and a summary view to be used when displaying a list +of contents on a single page. Hugo makes no assumptions here about how you want +to display your content, and will support as many different views of a content +type as your site requires. All that is required for these additional views is +that a template exists in each layout/type directory with the same name. + +For these, reviewing this example site will be very helpful in order to understand how these types work. + +## Assigning a content type + +Hugo assumes that your site will be organized into [sections](/content/sections) +and each section will use the corresponding type. If you are taking advantage of +this then each new piece of content you place into a section will automatically +inherit the type. + +Alternatively you can set the type in the meta data under the key "type". + + + diff --git a/docs/content/doc/contributors.md b/docs/content/doc/contributors.md deleted file mode 100644 index 4bc5a9d31..000000000 --- a/docs/content/doc/contributors.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "Contributors" -date: "2013-07-01" ---- - -Hugo was built with love and golang by: - -* [spf13](https://github.com/spf13) - diff --git a/docs/content/doc/organization.md b/docs/content/doc/organization.md deleted file mode 100644 index f524c59d0..000000000 --- a/docs/content/doc/organization.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Organization" -Pubdate: "2013-07-01" ---- - -Hugo uses markdown files with headers commonly called the front matter. Hugo respects the organization -that you provide for your content to minimize any extra configuration, though this can be overridden -by additional configuration in the front matter. - -## Organization -In Hugo the content should be arranged in the same way they are intended for the rendered website. -Without any additional configuration the following will just work. - - . - └── content - ├── post - | ├── firstpost.md // <- http://site.com/post/firstpost.html - | └── secondpost.md // <- http://site.com/post/secondpost.html - └── quote - ├── first.md // <- http://site.com/quote/first.html - └── second.md // <- http://site.com/quote/second.html - diff --git a/docs/content/doc/templates.md b/docs/content/doc/templates.md deleted file mode 100644 index 6b6e0f34c..000000000 --- a/docs/content/doc/templates.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: "Templates" -Pubdate: "2013-07-01" ---- - -Hugo uses the excellent golang html/template library for it's template engine. It is an extremely -lightweight engine that provides a very small amount of logic. In our -experience that it is just the right amount of logic to be able to create a good static website - -This document will not cover how to use golang templates, but the [golang docs](http://golang.org/pkg/html/template/) -provide a good introduction. - -### Template roles - -There are 5 different kinds of templates that Hugo works with. - -#### index.html -This file must exist in the layouts directory. It is the template used to render the -homepage of your site. - -#### rss.xml -This file must exist in the layouts directory. It will be used to render all rss documents. -The one provided in the example application will generate an ATOM format. - -*Important: Hugo will automatically add the following header line to this file.* - - <?xml version="1.0" encoding="utf-8" standalone="yes" ?> - -#### Indexes -An index is a page that list multiple pieces of content. If you think of a typical blog, the tag -pages are good examples of indexes. - - -#### Content Type(s) -Hugo supports multiple types of content. Another way of looking at this is that Hugo has the ability -to render content in a variety of ways as determined by the type. - -#### Chrome -Chrome is simply the decoration of your site. It's not a requirement to have this, but in practice -it's very convenient. Hugo doesn't know anything about Chrome, it's simply a convention that you may -likely find beneficial. As you create the rest of your templates you will include templates from the -/layout/chrome directory. I've found it helpful to include a header and footer template -in Chrome so I can include those in the other full page layouts (index.html, indexes/ type/single.html). - -### Adding a new content type - -Adding a type is easy. - -**Step 1:** -Create a directory with the name of the type in layouts.Type is always singular. *Eg /layouts/post*. - -**Step 2:** -Create a file called single.html inside your directory. *Eg /layouts/post/single.html*. - -**Step 3:** -Create a file with the same name as your directory in /layouts/indexes/. *Eg /layouts/index/post.html*. - -**Step 4:** -Many sites support rendering content in a few different ways, for instance a single page view and a -summary view to be used when displaying a list of contents on a single page. Hugo makes no assumptions -here about how you want to display your content, and will support as many different views of a content -type as your site requires. All that is required for these additional views is that a template -exists in each layout/type directory with the same name. - -For these, reviewing this example site will be very helpful in order to understand how these types work. - diff --git a/docs/content/doc/aliases.md b/docs/content/extras/aliases.md index 1e8a3556e..d1228d696 100644 --- a/docs/content/doc/aliases.md +++ b/docs/content/extras/aliases.md @@ -1,9 +1,10 @@ --- title: "Aliases" -Pubdate: "2013-07-09" -Aliases: +date: "2013-07-09" +aliases: - /doc/redirects/ - /doc/alias/ + - /doc/aliases/ --- For people migrating existing published content to Hugo theres a good chance diff --git a/docs/content/doc/indexes.md b/docs/content/extras/indexes.md index 9731a7739..b08c83742 100644 --- a/docs/content/doc/indexes.md +++ b/docs/content/extras/indexes.md @@ -1,6 +1,7 @@ --- title: "Indexes" -Pubdate: "2013-07-01" +date: "2013-07-01" +aliases: ["/doc/indexes/"] --- Hugo includes support for user defined indexes of content. In our @@ -70,8 +71,6 @@ The following variables are available to the index template: </div> </section> - <aside id="meta"> </aside> - {{ template "chrome/footer.html" }} @@ -88,13 +87,13 @@ and assign all keys you want this content to match against. #### Example { - "Title": "Hugo: A fast and flexible static site generator", - "Tags": [ + "title": "Hugo: A fast and flexible static site generator", + "tags": [ "Development", "golang", "Blogging" ], - "Slug": "hugo", + "slug": "hugo", "project_url": "http://github.com/spf13/hugo" } diff --git a/docs/content/extras/indexes/category.md b/docs/content/extras/indexes/category.md new file mode 100644 index 000000000..6b948124d --- /dev/null +++ b/docs/content/extras/indexes/category.md @@ -0,0 +1,54 @@ +--- +title: "Index Category Example" +date: "2013-07-01" +--- + +This page demonstrates an example of using indexes to provide categories for your site. + +### 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 +effort to support as many languages as possible.* + + --- + indexes: + category: "categories" + baseurl: "http://spf13.com/" + title: "Steve Francia is spf13.com" + --- + +### /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/. + + {{ template "chrome/header.html" . }} + {{ template "chrome/subheader.html" . }} + + <section id="main"> + <div> + <h1 id="title">{{ .Title }}</h1> + {{ range .Data.Pages }} + {{ .Render "summary"}} + {{ end }} + </div> + </section> + + {{ template "chrome/footer.html" }} + + +### Assigning indexes to content + +Make sure that the index is set in the front matter: + + { + "title": "Hugo: A fast and flexible static site generator", + "categories": [ + "Development", + "golang", + "Blogging" + ], + "slug": "hugo" + } + diff --git a/docs/content/extras/indexes/series.md b/docs/content/extras/indexes/series.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/content/extras/indexes/series.md diff --git a/docs/content/doc/shortcodes.md b/docs/content/extras/shortcodes.md index 222963b03..a288fe585 100644 --- a/docs/content/doc/shortcodes.md +++ b/docs/content/extras/shortcodes.md @@ -1,6 +1,7 @@ --- title: "Shortcodes" -Pubdate: "2013-07-01" +date: "2013-07-01" +aliases: ["/doc/shortcodes/"] --- Because Hugo uses markdown for it's content format, it was clear that there's a lot of things that diff --git a/docs/content/layout/chrome.md b/docs/content/layout/chrome.md new file mode 100644 index 000000000..1616625a3 --- /dev/null +++ b/docs/content/layout/chrome.md @@ -0,0 +1,80 @@ +--- +title: "Chrome Templates" +date: "2013-07-01" +--- +Chrome is a convention to create templates that are used by the other templates +throughout the site. There is nothing special about the name "chrome", feel free +to provide and use your own. + +It's not a requirement to have this, but in practice it's very convenient. Hugo doesn't +know anything about Chrome, it's simply a convention that you may likely find +beneficial. As you create the rest of your templates you will include templates +from the /layout/chrome directory. + +I've found it helpful to include a header and footer template in Chrome so I can +include those in the other full page layouts (index.html, indexes/ +type/single.html). There is nothing special about header.html and footer.html +other than they seem like good names to use for inclusion in your other +templates. + + ▾ layouts/ + ▾ chrome/ + header.html + footer.html + +By ensuring that we only reference [variables](/layout/variables/) variables +used for both nodes and pages we can use the same chrome for both. + +## example header.html +This header template is used for [spf13.com](http://spf13.com). + + <!DOCTYPE html> + <html class="no-js" lang="en-US" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#"> + <head> |