diff --git a/.gitignore b/.gitignore index 3cb9c3f4c..d30fde92c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ themes/hugodocs/pipeline/node_modules -my-notes.md +ryans-notes.md notes-for-reviewers.md \ No newline at end of file diff --git a/content-changes.md b/content-changes.md index 18552b531..eb6370e78 100644 --- a/content-changes.md +++ b/content-changes.md @@ -1,4 +1,4 @@ -# Content Reorganization +# Annotated Content Reorganization - [Changes to Existing Content Sections](#changes-to-existing-sections) - [Extras](#extras) @@ -27,6 +27,9 @@ The following is an *abbreviated* listing and only includes the *larger* changes * All content moved from `/tutorials` edited to reflect a less tutorial-ish style of language (e.g., remove of lines starting with "In this tutorial...") * Aliases added to new pages and in-page links updated throughout + + + ## Content Organization: Site Navigation The following is a list of weights for the newly restructure site architecture diff --git a/content/about-hugo/_index.md b/content/about-hugo/_index.md index ffebc47ae..8bfa351d1 100644 --- a/content/about-hugo/_index.md +++ b/content/about-hugo/_index.md @@ -5,11 +5,10 @@ description: Hugo's features, roadmap, and license, as well as the motivation be date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -tags: [] categories: [] +tags: [] weight: 01 draft: false aliases: [] toc: false -notesforauthors: --- \ No newline at end of file diff --git a/content/about-hugo/benefits-of-static.md b/content/about-hugo/benefits-of-static.md index 905aa868e..4698a60d3 100644 --- a/content/about-hugo/benefits-of-static.md +++ b/content/about-hugo/benefits-of-static.md @@ -6,12 +6,10 @@ date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 tags: [ssg,static,performance, security] -weight: 20 +weight: 30 draft: false -slug: aliases: [] toc: false -notesforauthors: --- Website generators render content into HTML files. Most are "dynamic site generators." That means the HTTP server (i.e., the program that communicates with your end user's browser) runs the generator to create a new HTML file every time an end user requests a page. diff --git a/content/about-hugo/hugo-features.md b/content/about-hugo/hugo-features.md index 2b1d50de2..c7fe61577 100644 --- a/content/about-hugo/hugo-features.md +++ b/content/about-hugo/hugo-features.md @@ -5,9 +5,8 @@ description: In addition to blistering speed, Hugo also includes a powerful temp date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -weight: 10 +weight: 20 draft: false -slug: aliases: [/about-hugo/features] toc: true notesforauthors: diff --git a/content/about-hugo/license.md b/content/about-hugo/license.md index e34938f53..efb11bb9a 100644 --- a/content/about-hugo/license.md +++ b/content/about-hugo/license.md @@ -1,16 +1,16 @@ --- title: Apache License -linktitle: +linktitle: License description: Hugo v0.15 and later are released under the Apache 2.0 license. Earlier versions of Hugo were released under the Simple Public License. date: 2016-02-01 publishdate: 2016-02-01 lastmod: 2016-02-01 -weight: 50 +categories: ["about hugo"] +tags: ["license","apache"] +weight: 60 draft: false -slug: aliases: [/meta/license] toc: true -notesforauthors: --- {{% note %}} diff --git a/content/about-hugo/roadmap.md b/content/about-hugo/roadmap.md index 3a635e5f1..224feaca7 100644 --- a/content/about-hugo/roadmap.md +++ b/content/about-hugo/roadmap.md @@ -6,7 +6,7 @@ date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 tags: [] -weight: 40 +weight: 50 draft: false slug: aliases: [/meta/roadmap] diff --git a/content/about-hugo/what-is-hugo.md b/content/about-hugo/what-is-hugo.md index 25ba68450..ee25ffa66 100644 --- a/content/about-hugo/what-is-hugo.md +++ b/content/about-hugo/what-is-hugo.md @@ -6,11 +6,10 @@ date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 layout: single -weight: 05 +weight: 10 draft: false aliases: [/overview/introduction/] toc: true -notesforauthors: --- ## What is Hugo? diff --git a/content/about-hugo/why-i-built-hugo.md b/content/about-hugo/why-i-built-hugo.md index 1227c6540..f9d07bd17 100644 --- a/content/about-hugo/why-i-built-hugo.md +++ b/content/about-hugo/why-i-built-hugo.md @@ -5,12 +5,10 @@ description: Learn why Steve Francia (@spf13) decided to ditch his previous cont date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -weight: 30 +weight: 40 draft: false -slug: aliases: [] toc: false -notesforauthors: --- I wrote Hugo ultimately for a few reasons. First, I was disappointed with WordPress, my then website solution. With it, I couldn't create content as efficiently as I wanted to. diff --git a/content/commands/_index.md b/content/commands/_index.md index c339aa119..93f4dd8b3 100644 --- a/content/commands/_index.md +++ b/content/commands/_index.md @@ -5,7 +5,7 @@ description: Comprehensive list of Hugo templating functions, including basic an date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -categories: [command line reference] +categories: [commands] tags: [cli,command line] weight: 01 draft: false @@ -16,7 +16,4 @@ needsreview: true The following list contains auto-generated and up-to-date (thanks to [Cobra][]) documentation for all the CLI commands in Hugo. - - - -[Cobra]: https://github.com/spf13/cobra \ No newline at end of file +[Cobra]: https://github.com/spf13/cobra diff --git a/content/content-management/_index.md b/content/content-management/_index.md index 99f33ff6f..671198949 100644 --- a/content/content-management/_index.md +++ b/content/content-management/_index.md @@ -11,5 +11,4 @@ weight: 01 draft: false aliases: [/content/] toc: false -notesforauthors: --- diff --git a/content/content-management/archetypes.md b/content/content-management/archetypes.md index 27b464013..e20c55529 100644 --- a/content/content-management/archetypes.md +++ b/content/content-management/archetypes.md @@ -7,7 +7,7 @@ publishdate: 2017-02-01 lastmod: 2017-02-01 tags: [archetypes,generators,metadata,front matter] categories: ["content management"] -weight: 50 +weight: 70 draft: false aliases: [/content/archetypes/,/content-management/content-archetypes/] toc: true @@ -182,7 +182,7 @@ The following is the `musicians` archetype from the [example site][]: [archetypes directory]: /project-organization/directory-structure/ [`now()`]: http://golang.org/pkg/time/#Now [configuration file]: /project-organization/configuration/ -[content sections]: /content-sections/ +[content sections]: /sections/ [content types]: /content-management/content-types/ [example site]: /getting-started/using-the-hugo-docs/#example-site [front matter]: /content-management/front-matter/ diff --git a/content/content-management/comments.md b/content/content-management/comments.md new file mode 100644 index 000000000..b3b76e896 --- /dev/null +++ b/content/content-management/comments.md @@ -0,0 +1,113 @@ +--- +title: Comments +linktitle: Comments +description: Hugo ships with an internal Disqus template that requires negligible effort to implement, but Disqus isn't the only commenting system that will work with your new Hugo website. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +tags: [sections,content,organization, fundamentals] +categories: [project organization] +weight: 140 +draft: false +aliases: [/extras/comments/] +toc: true +needsreview: true +--- + + + +As Hugo is a static site generator, the content produced is static and doesn’t interact with the users. The most common interaction people ask for is comment capability. + +Hugo ships with support for [Disqus](https://disqus.com/), a third-party service that provides comment and community capabilities to website via JavaScript. + +Your theme may already support Disqus, but even it if doesn’t, it is easy to add. + +### Disqus + +#### Adding Disqus to a Template + +Hugo comes with all the code you would need to include load Disqus. Simply include the following line where you want your comments to appear: + +```golang +{{ template "_internal/disqus.html" . }} +``` + +#### Configuring Disqus + +That template requires you to set a single value in your site `config`: + +```toml +disqusShortname = "yourdiscussshortname" +``` + +Or with a `config.yml`: + +```yaml +disqusShortname: "yourdiscussshortname" +``` + +You also have the option to set the following in the front matter for a given piece of content: + +* `disqus_identifier` +* `disqus_title` +* `disqus_url` + +#### Conditional Loading of Disqus Comments + +Users have noticed that enabling Disqus comments when running the Hugo web server on `localhost` (i.e. via `hugo server`) causes the creation of unwanted discussions on the associated Disqus account. In order to prevent this, a slightly tweaked partial template is required. So, rather than using the built-in `"_internal/disqus.html"` template referenced above, create a template in `layouts/partials` that looks like the following: + +{{% input "layouts/partials/disqus.html" %}} +```html +
+ + +comments powered by Disqus +``` +{{% /input %}} + +The `if` statement skips the initialization of the Disqus comment injection when you are running on `localhost`. + +You can then reference the partial template: + +{{% input "disqus-reference.html" %}} +```golang +{{ partial "disqus.html" . }} +``` +{{% /input %}} + +## Alternatives + +A few alternatives exist to [Disqus](https://disqus.com/): + +* [Discourse](http://www.discourse.org) +* [IntenseDebate](http://intensedebate.com/) +* [Livefyre](http://livefyre.com/) +* [Muut](http://muut.com/) +* [多说](http://duoshuo.com/) ([Duoshuo](http://duoshuo.com/), popular in China) +* [isso](http://posativ.org/isso/) (Self-hosted, Python) +* [Kaiju](https://github.com/spf13/kaiju) + +## Kaiju + +[Kaiju](https://github.com/spf13/kaiju) is an open-source project started by [spf13](http://spf13.com/) (Hugo’s author) to bring easy and fast real time discussions to the web. + +Written using Go, Socket.io and MongoDB, it is very fast and easy to deploy. + +It is in early development but shows promise. If you have interest, please help by contributing whether via a pull request, an issue or even just a tweet. Everything helps. + +## Discourse + +Additionally, you may recognize [Discourse](http://www.discourse.org) as the system that powers the [Hugo Discussion Forum](http://discuss.gohugo.io). \ No newline at end of file diff --git a/content/content-management/content-organization.md b/content/content-management/content-organization.md index c5de6e0fb..3e704c8a6 100644 --- a/content/content-management/content-organization.md +++ b/content/content-management/content-organization.md @@ -5,11 +5,10 @@ description: Hugo assumes that the same structure that works to organize your so date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -tags: [sections,content,organization, fundamentals] categories: [project organization] -weight: 05 +tags: [sections,content,organization, fundamentals] +weight: 10 draft: false -slug: aliases: [/content-management/sections,/content/sections/] toc: true needsreview: true @@ -19,7 +18,7 @@ Hugo uses files (see [supported content formats][]) with headers called [front m ## Organizing Source Content -In Hugo, the content should be organized in a manner that reflects the rendered website. Without any additional configuration, the following will just work. Hugo supports content nested at any level, but the top level is special in Hugo and is used as the [section](/content-management/content-sections/). +In Hugo, the content should be organized in a manner that reflects the rendered website. Without any additional configuration, the following will just work. Hugo supports content nested at any level, but the top level is special in Hugo and is used as the [section](/content-management/sections/). ```bash . diff --git a/content/content-management/content-summaries.md b/content/content-management/content-summaries.md index 6dd201888..0ee289b25 100644 --- a/content/content-management/content-summaries.md +++ b/content/content-management/content-summaries.md @@ -5,14 +5,12 @@ description: date: 2017-01-10 publishdate: 2017-01-10 lastmod: 2017-01-10 -tags: [summaries,abstracts,read more] categories: [content management] -weight: 70 +tags: [summaries,abstracts,read more] +weight: 90 draft: false -slug: aliases: [/content/summaries/] toc: true -notesforauthors: --- With the use of the `.Summary` [page variable][pagevariables], Hugo can generate summaries of content to show snippets in summary views. The summary view snippets are automatically generated by Hugo. @@ -26,23 +24,23 @@ You have two options for where the content is split: Content summaries may also provide links to the original content. A common design pattern is to see this link in the form of a "Read More..." button. To make this easier, you can leverage the `.RelPermalink`, `.Permalink`, and `.Truncated` [page variables][pagevariables]. -### Hugo-defined: Automatic Splitting +### Hugo-defined: Automatic Summary Splitting By default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the `.Summary` page variable for use in your templates. Taking the Hugo-defined approach to summaries may save time, but it has pros and cons: * **Pros:** Automatic, no additional work on your part. * **Cons:** All HTML tags are stripped from the summary, and the first 70 words, whether they belong to a heading or to different paragraphs, are all lumped into one paragraph. -### User-defined: Manual Splitting +### User-defined: Manual Summary Splitting -Alternatively, you may add the <!--more--> summary divider where you want to split the article. Content that comes before the summary divider will be used as that content's summary and stored in the `.Summary` page variable with all HTML formatting intact. +Alternatively, you may add the <!--more--> summary divider where you want to split the article. For [org content][org], use # more) where you want to split the article. Content that comes before the summary divider will be used as that content's summary and stored in the `.Summary` page variable with all HTML formatting intact. {{% note "Summary Divider"%}} The concept of a *summary divider* is not unique to Hugo. It is also called the "more tag" or "excerpt separator" in other literature. {{% /note %}} * Pros: Freedom, precision, and improved rendering. All HTML tags and formatting are preserved. -* Cons: Extra work for content authors, since they need to remember to type <!--more--> in each content file. +* Cons: Extra work for content authors, since they need to remember to type <!--more--> (or `# more` for [org content][org]) in each content file. {{% warning "Be Precise with the Summary Divider" %}} Be careful to enter <!--more--> exactly; i.e., all lowercase and with no whitespace. Any mistakes in the divider will tell Hugo to treat the divider as a regular comment and will fail to store your desired content in the `.Summary` variable. @@ -72,5 +70,6 @@ You can show content summaries with the following code. You could use the follow Note how the `.Truncated` boolean valuable may be used to hide the "Read More..." link when the content is not truncated; i.e., when the summary contains the entire article. +[org]: /content-management/supported-content-formats/ [pagevariables]: /variables-and-params/page-variables/ [section's list page template]: /templates/list-and-section-templates/ \ No newline at end of file diff --git a/content/content-management/content-types.md b/content/content-management/content-types.md index b46538035..98970e70b 100644 --- a/content/content-management/content-types.md +++ b/content/content-management/content-types.md @@ -5,11 +5,10 @@ description: date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -tags: [lists,sections,content types,types,organization] categories: [content management] -weight: 40 +tags: [lists,sections,content types,types,organization] +weight: 60 draft: false -slug: aliases: [/content/types] toc: true needsreview: true @@ -34,7 +33,7 @@ You can manually add files to your content directories, but Hugo has the ability Creating a new content type is easy in Hugo. You simply provide the templates and archetype that the new type will use. You only need to define the templates, archetypes and/or views unique to that content type. Hugo will fall back to using the general templates and default archetype whenever a specific file is not present. {{% note "Declaring Content Types" %}} -Remember, all of the following are *optional*. If you do not specifically declare content types in your front matter or develop specific layouts for content types, Hugo is smart enough to infer the content type from the file path and content section (see [content sections](/content-management/content-sections/)). +Remember, all of the following are *optional*. If you do not specifically declare content types in your front matter or develop specific layouts for content types, Hugo is smart enough to infer the content type from the file path and content section (see [content sections](/content-management/sections/)). {{% /note %}} ### Create Type Layout Directory @@ -61,7 +60,7 @@ More details about archetypes can be found in the [archetypes documentation][]. [archetypes]: /content-management/archetypes/ [archetypes documentation]: /content-management/archetypes/ -[sections]: /content-sections/ +[sections]: /content-management/sections/ [front matter]: /content-management/front-matter/ [list of contents on a single page]: /templates/list-and-section-templates/ [template]: /templates/ diff --git a/content/content-management/cross-references.md b/content/content-management/cross-references.md index fb010d088..210b977fd 100644 --- a/content/content-management/cross-references.md +++ b/content/content-management/cross-references.md @@ -7,12 +7,11 @@ publishdate: 2017-02-01 lastmod: 2017-01-09 categories: [content management] tags: ["cross references","references", "anchors", "urls"] -weight: 80 +weight: 100 draft: false aliases: [] -toc: +toc: true needsreview: true -notesforauthors: --- Hugo makes it easy to link documents together with `ref` and `relref`, both of which are [built-in Hugo shortcodes][]. These shortcodes are also used to safely provide links to headings inside of your content, whether across documents or within a document. The only difference between `ref` and `relref` is whether the resulting URL is absolute (`http://1.com/about/`) or relative (`/about/`). diff --git a/content/content-management/front-matter.md b/content/content-management/front-matter.md index 44bd02a7e..e2896f3e4 100644 --- a/content/content-management/front-matter.md +++ b/content/content-management/front-matter.md @@ -7,9 +7,8 @@ publishdate: 2017-01-09 lastmod: 2017-01-09 categories: [content management] tags: ["front matter", "yaml", "toml", "json", "metadata", "archetypes"] -weight: 20 +weight: 30 draft: false -slug: aliases: [/content/front-matter/] needsreview: true toc: @@ -104,11 +103,11 @@ There are a few predefined variables that Hugo is aware of and utilizes. The use If neither `slug` nor `url` is present, and [permalinks are not configured otherwise](/content-management/url-management/#permalinks), the filename will be used to create the URL for a page. {{% /note %}} -## Configure Blackfriday Rendering +## Override Global Blackfriday Configuration It's possible to set some options for Markdown rendering in the page's front matter as an override to the site-wide configuration. -See [site configuration][] for more information. +See [site configuration][] for more information on setting up global Blackfriday options. ## Parameters diff --git a/content/content-management/menus.md b/content/content-management/menus.md index 9cf54fa70..c1a6c0a31 100644 --- a/content/content-management/menus.md +++ b/content/content-management/menus.md @@ -5,10 +5,10 @@ description: date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -weight: categories: [templating] tags: [lists,sections,menus] draft: false +weight: 120 aliases: [/extras/menus/] toc: true needsreview: true diff --git a/content/content-management/multilingual-mode.md b/content/content-management/multilingual-mode.md index b163ccf39..aec87f70b 100644 --- a/content/content-management/multilingual-mode.md +++ b/content/content-management/multilingual-mode.md @@ -7,10 +7,9 @@ publishdate: 2017-01-10 lastmod: 2017-01-10 categories: [content management] tags: [multilingual,i18n] -weight: 120 +weight: 150 draft: false -slug: -aliases: [/content/multilingual/] +aliases: [/content/multilingual/,/content-management/multilingual/] toc: true needsreview: true notesforauthors: @@ -46,20 +45,20 @@ help = "Aide" ``` Anything not defined in a `[Languages]` block will fall back to the global -value for that key (like `copyright` for the English (`en`) language in this example). +value for that key (e.g., `copyright` for the English [`en`] language). -With the config above, all content, sitemap, RSS feeds, paginations +With the config above, all content, sitemap, RSS feeds, paginations, and taxonomy pages will be rendered below `/` in English (your default content language), and below `/fr` in French. -When working with params in frontmatter pages, omit the `params` in the key for the translation. +When working with params in front matter pages, omit the `params` in the key for the translation. If you want all of the languages to be put below their respective language code, enable `defaultContentLanguageInSubdir: true` in your configuration. Only the obvious non-global options can be overridden per language. Examples of global options are `BaseURL`, `BuildDrafts`, etc. -Taxonomies and Blackfriday configuration can also be set per language, example: +Taxonomies and [Blackfriday configuration][hugoconfig] can also be set per language: -``` +```toml [Taxonomies] tag = "tags" @@ -81,12 +80,11 @@ title = "Français" plaque = "plaques" ``` - -### Translating your content +## Translating Your Content Translated articles are identified by the name of the content file. -Example of translated articles: +### Examples of Translated Articles 1. `/content/about.en.md` 2. `/content/about.fr.md` @@ -103,11 +101,12 @@ If left unspecified, the value for `defaultContentLanguage` defaults to `en`. By having the same _base file name_, the content pieces are linked together as translated pieces. -### Link to translated content +## Link to Translated Content To create a list of links to translated content, use a template similar to this: -``` +{{% input "layouts/partials/i18nlist.html" %}} +```html {{ if .IsTranslated }}

{{ i18n "translations" }}

{{ end }} ``` -The above can be put in a `partial` and included in any template, be it for a content page or the home page. It will not print anything if there are no translations for a given page, or if it is -- in the case of the home page, section listing etc. -- a site with only one language. +{{% /input %}} -The above also uses the `i18n` func, see [Translation of strings](#translation-of-strings). +The above can be put in a `partial` (`./layouts/partials/`) and included in any template, be it for a [content page][contenttemplate] or the [home page][homepagetemplte]. It will not print anything if there are no translations for a given page, or if it is---in the case of the home page, section listing, etc.---a site with only one language. -### Translation of strings +The above also uses the `i18n` func described in the next section. -Hugo uses [go-i18n](https://github.com/nicksnyder/go-i18n) to support string translations. Follow the link to find tools to manage your translation workflows. +## Translation of Strings + +Hugo uses [go-i18n](https://github.com/nicksnyder/go-i18n) to support string translations. [See the project's source repository](https://github.com/nicksnyder/go-i18n) to find tools that will help you manage your translation workflows. Translations are collected from the `themes/[name]/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to RFC 5646 with names such as `en-US.yaml`, `fr.yaml`, etc. @@ -174,7 +175,7 @@ To track down missing translation strings, run Hugo with the `--i18n-warnings` f i18n|MISSING_TRANSLATION|en|wordCount ``` -### Menus +## Menus You can define your menus for each language independently. The [creation of a menu](/content-management/menus/) works analogous to earlier versions of Hugo, except that they have to be defined in their language-specific block in the configuration file: @@ -215,16 +216,25 @@ The rendering of the main navigation works as usual. `.Site.Menus` will just con ``` -### Missing translations +## Missing translations If a string does not have a translation for the current language, Hugo will use the value from the default language. If no default value is set, an empty string will be shown. -While translating a Hugo site, it can be handy to have a visual indicator of missing translations. The `EnableMissingTranslationPlaceholders` config option will flag all untranslated strings with the placeholder `[i18n] identifier`, where `identifier` is the id of the missing translation. +While translating a Hugo website, it can be handy to have a visual indicator of missing translations. The [`EnableMissingTranslationPlaceholders` configuration option][hugoconfig] will flag all untranslated strings with the placeholder `[i18n] identifier`, where `identifier` is the id of the missing translation. -**Remember: Hugo will generate your website with these placeholders. It might not be suited for production environments.** +{{% note %}} +Hugo will generate your website with these placeholders. It might not be suited for production environments. +{{% /note %}} -### Multilingual Themes support +## Multilingual Themes support -To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there are more than one language, URLs must either come from the built-in `.Permalink` or `.URL`, be constructed with `relLangURL` or `absLangURL` template funcs -- or prefixed with `{{.LanguagePrefix }}`. +To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there is more than one language, URLs must -If there are more than one language defined, the`LanguagePrefix` variable will equal `"/en"` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string, so it is harmless for single-language sites. \ No newline at end of file +* come from the built-in `.Permalink` or `.URL` +* be constructed with `relLangURL` or `absLangURL` template funcs **or** prefixed with `{{.LanguagePrefix }}` + +If there is more than one language defined, the`LanguagePrefix` variable will equal `/en` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string and is therefore harmless for single-language Hugo websites. + +[contenttemplate]: /templates/single-page-template/ +[homepagetemplate]: /templates/homepage-template/ +[hugoconfig]: /getting-started/configuration/ \ No newline at end of file diff --git a/content/content-management/content-sections.md b/content/content-management/sections.md similarity index 97% rename from content/content-management/content-sections.md rename to content/content-management/sections.md index 3c7a96cfb..c5b5dc3de 100644 --- a/content/content-management/content-sections.md +++ b/content/content-management/sections.md @@ -1,25 +1,23 @@ --- -title: Sections +title: Content Sections linktitle: Sections description: Hugo provides full support for content sections, which according to Hugo's default behavior, should reflect the architecture of the output website sections as well. date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -tags: [lists,sections,content types,organization] categories: [content management] -weight: 30 +tags: [lists,sections,content types,organization] +weight: 50 draft: false -slug: aliases: [/content-management/sections/,/content/sections/] toc: true -notesforauthors: --- ## What are Sections in Hugo Hugo believes 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 [directory structure][]). -Following this pattern, Hugo uses the top level of your content organization as the **content section**. +Following this pattern, Hugo uses the top level of your content organization as the content **section**. The [example site][] used throughout the Hugo docs includes three sections: "authors," "events," and "posts". The following illustrates both the source organization and the default URL structure for the rendered files: diff --git a/content/content-management/supported-content-formats.md b/content/content-management/supported-content-formats.md index d9d351af6..2c003524a 100644 --- a/content/content-management/supported-content-formats.md +++ b/content/content-management/supported-content-formats.md @@ -1,31 +1,30 @@ --- title: Supported Content Formats -linktitle: +linktitle: Content Formats description: Hugo uses the Blackfriday markdown parser for content files but also provides support for additional syntaxes (eg, Asciidoc) via external helpers. date: 2017-01-10 publishdate: 2017-01-10 lastmod: 2017-01-10 categories: [content management] tags: [markdown,asciidoc,mmark,content format] -weight: 10 +weight: 20 draft: false -slug: -aliases: [/content/markdown-extras/,/content/supported-formats/,/content/markdown/] +aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-formats/] toc: true notesforauthors: --- ## Markdown -Markdown is the natively supported content format for Hugo and is rendered using the excellent [Blackfriday project][], a markdown parser written in Golang. +Markdown is the native content format for Hugo and is rendered using the excellent [Blackfriday project][], a blazingly fast parser written in Golang. {{% note "Deeply Nested Lists" %}} -Blackfriday has a known issue [(#329)](https://github.com/russross/blackfriday/issues/329) with handling deeply nested lists, but there is a workaround. If you write lists in markdown, use 4 spaces (i.e., tab) rather than 2 to delimit nesting of lists. +Blackfriday has a known issue [(#329)](https://github.com/russross/blackfriday/issues/329) with handling deeply nested lists. Luckily, there is a workaround. Use 4-spaces (i.e., tab) rather than 2-space indentations to delimit nesting of lists. {{% /note %}} ## Additional Content Formats -Since 0.14, Hugo has defined a new concept called _external helpers_. This means you can write your content using [Asciidoc][] or [reStructuredText][]. If you have files with associated extensions, Hugo will call external commands to generate the content ([see Hugo source code][]). +Since 0.14, Hugo has defined a new concept called _external helpers_. This means you can write your content using [Asciidoc][], [reStructuredText][], or [Org-mode][]. If you have files with associated extensions, Hugo will call external commands to generate the content ([see Hugo source code][]). The exception is Org-mode, which is parsed natively. For example, for Asciidoc files, Hugo will try to call the **asciidoctor** or **asciidoc** command. This means that you will have to install the associated tool on your machine to be able to use these formats. @@ -89,6 +88,7 @@ Hugo supports GitHub-flavored markdown's use of triple back ticks, as well as pr [Daring Fireball: Markdown, John Gruber]: https://daringfireball.net/projects/markdown/ [developer tools]: /developer-tools/ [Markdown Tutorial]: http://www.markdowntutorial.com/ +[Org-mode]: http://orgmode.org/ [Pygments]: http://pygments.org/ [reStructuredText]: http://docutils.sourceforge.net/rst.html [see Hugo source code]: https://github.com/spf13/hugo/blob/77c60a3440806067109347d04eb5368b65ea0fe8/helpers/general.go#L65 diff --git a/content/content-management/table-of-contents.md b/content/content-management/table-of-contents.md index 8e9951bb3..bcc4afb19 100644 --- a/content/content-management/table-of-contents.md +++ b/content/content-management/table-of-contents.md @@ -5,9 +5,9 @@ description: date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -tags: [table of contents, toc] categories: [content management] -weight: 100 +tags: [table of contents, toc] +weight: 130 draft: false aliases: [/extras/toc/] toc: false diff --git a/content/content-management/taxonomies.md b/content/content-management/taxonomies.md index 7195337b5..e84bb2eb1 100644 --- a/content/content-management/taxonomies.md +++ b/content/content-management/taxonomies.md @@ -7,9 +7,8 @@ publishdate: 2017-02-01 lastmod: 2017-02-01 tags: [taxonomies,metadata,front matter,terms] categories: [content management] -weight: 60 +weight: 80 draft: false -slug: aliases: [/taxonomies/overview/,/taxonomies/usage/,/indexes/overview/,/doc/indexes/,/extras/indexes] toc: true notesforauthors: diff --git a/content/content-management/url-management.md b/content/content-management/url-management.md index e77335bc6..bf149a06e 100644 --- a/content/content-management/url-management.md +++ b/content/content-management/url-management.md @@ -7,17 +7,13 @@ publishdate: 2017-02-01 lastmod: 2017-02-01 tags: [aliases,redirects,permalinks,urls] categories: [content management] -weight: 90 +weight: 110 draft: false -aliases: [/extras/permalinks/,/extras/aliases/,/content-management/permalinks-and-redirects/,/extras/urls/] +aliases: [/extras/permalinks/,/extras/aliases/,/content-management/permalinks-and-redirects/,/extras/urls/,/doc/redirects/,/doc/alias/,/doc/aliases/] toc: true needsreview: true --- -## Base URL - -## URLs - ## Permalinks By default, content is laid out into the target `publishdir` (public) @@ -59,6 +55,95 @@ The following is a list of values that can be used in a `permalink` definition i ## Aliases +For people migrating existing published content to Hugo, there's a good chance you need a mechanism to handle redirecting old URLs. + +Luckily, redirects can be handled easily with _aliases_ in Hugo. + +## Example + +Given a post on your current Hugo site, with a path of: + +``content/posts/my-awesome-blog-post.md`` + +... you create an "aliases" section in the frontmatter of your post, and add previous paths to that. + +### TOML frontmatter + +```toml ++++ + ... +aliases = [ + "/posts/my-original-url/", + "/2010/01/01/even-earlier-url.html" +] + ... ++++ +``` + +### YAML frontmatter + +```yaml +--- + ... +aliases: + - /posts/my-original-url/ + - /2010/01/01/even-earlier-url.html + ... +--- +``` + +Now when you visit any of the locations specified in aliases, _assuming the same site domain_, you'll be redirected to the page they are specified on. + +## Important Behaviors + +1. *Hugo makes no assumptions about aliases. They also don't change based +on your UglyURLs setting. You need to provide absolute path to your webroot +and the complete filename or directory.* + +2. *Aliases are rendered prior to any content and will be overwritten by +any content with the same location.* + +## Multilingual example + +On [multilingual sites](/content-management/multilingual/), each translation of a post can have unique aliases. To use the same alias across multiple languages, prefix it with the language code. + +In `/posts/my-new-post.es.md`: + +```yaml +--- +aliases: + - /es/posts/my-original-post/ +--- +``` + +## How Hugo Aliases Work + +When aliases are specified, Hugo creates a physical folder structure to match the alias entry, and, an html file specifying the canonical URL for the page, and a redirect target. + +Assuming a baseURL of `mysite.tld`, the contents of the html file will look something like: + +```html + + + + http://mysite.tld/posts/my-original-url + + + + + +``` + +The `http-equiv="refresh"` line is what performs the redirect, in 0 seconds in this case. + +## Customizing + +You may customize this alias page by creating an alias.html template in the +layouts folder of your site. In this case, the data passed to the template is + +* Permalink - the link to the page being aliased +* Page - the Page data for the page being aliased + ## Pretty URLs By default, Hugo renders your content with "pretty" URLs. For example, @@ -108,5 +193,5 @@ For example, if the `/post/first/` page contained a link with a relative URL of [Content Organization]: /content-management/content-organization/ [flag from the command line]: /getting-started/basic-usage/ -[sections]: /content-management/content-sections/ +[sections]: /content-management/sections/ [site configuration]: /project-organization/configuration/ \ No newline at end of file diff --git a/content/contribute-to-hugo/contribute-to-hugo-development.md b/content/contribute-to-hugo/contribute-to-hugo-development.md index 60ce40a0e..c8d20e620 100644 --- a/content/contribute-to-hugo/contribute-to-hugo-development.md +++ b/content/contribute-to-hugo/contribute-to-hugo-development.md @@ -374,11 +374,11 @@ If you have questions leave a comment in the pull request. We are willing to ass Thank you for reading this tutorial. Hopefully, we see you again on GitHub. There are plenty of [open issues](https://github.com/spf13/hugo/issues) on GitHub. Feel free to open an issue if you think you found a bug or you have a new idea to improve Hugo. We are happy to hear from you. -## Learning Git References +## Additional References for Learning Git -* [Codecademy's Free "Learn Git" Course][codecademy] -* [Code School and GitHub's Free "Try Git" Tutorial][trygit] -* [The Git Book][gitbook] +* [Codecademy's Free "Learn Git" Course][codecademy] (Free) +* [Code School and GitHub's "Try Git" Tutorial][trygit] (Free) +* [The Git Book][gitbook] (Free) [codecademy]: https://www.codecademy.com/learn/learn-git diff --git a/content/contribute-to-hugo/contribute-to-the-hugo-docs.md b/content/contribute-to-hugo/contribute-to-the-hugo-docs.md index d5f8fb90b..03f2ad12c 100644 --- a/content/contribute-to-hugo/contribute-to-the-hugo-docs.md +++ b/content/contribute-to-hugo/contribute-to-the-hugo-docs.md @@ -45,7 +45,7 @@ Documentation is an integral part of any open source project. The Hugo docs were ## Admonition Short Codes -**Admonitions** are a common in technical documentation. The most popular is that seen in [reStructuredTex Directives][sourceforge]. From the SourceForge documentation: +**Admonitions** are common directives in technical documentation. The most popular is that seen in [reStructuredTex Directives][sourceforge]. From the SourceForge documentation: > Admonitions are specially marked "topics" that can appear anywhere an ordinary body element can. They contain arbitrary body elements. Typically, an admonition is rendered as an offset block in a document, sometimes outlined or shaded, with a title matching the admonition type. - [SourceForge][sourceforge] diff --git a/content/getting-started/configuration.md b/content/getting-started/configuration.md index bd97a0850..91e8b96c5 100644 --- a/content/getting-started/configuration.md +++ b/content/getting-started/configuration.md @@ -16,14 +16,13 @@ notesforauthors: The [directory structure][] of a Hugo website—or more precisely, the source organization of files containing the website's content and templates—provides most of the configuration information that Hugo needs in order to statically generate a finished website. -Therefore, many websites may not need a configuration file. Hugo is designed to recognize certain typical usage patterns (and expects them, by default). +Because of Hugo's preference for sane defaults, many websites may not need a configuration file. Hugo is designed to recognize certain typical usage patterns (and even expects them by default). ## Configuration Lookup Order -Nevertheless, Hugo searches for a configuration file in the root of your website's source directory as a default behavior. First, it looks for a `./config.toml` file. If that's not present, it will seek a `./config.yaml` file, -followed by a `./config.json` file. +Hugo searches for a configuration file in the root of your website's source directory as a default behavior. First, it looks for a `./config.toml` file. If that's not present, it will seek a `./config.yaml` file, followed by a `./config.json` file. -In this `config` file, you can include precise directions to Hugo regarding how it should render your website, control your website's menus, and arbitrarily define site-wide parameters specific to your project. +In this `config` file, you can direct to Hugo as to how it should render your website, control your website's menus, and arbitrarily define site-wide parameters specific to your project. ## YAML Configuration @@ -325,7 +324,45 @@ ignoreFiles = [ "\\.foo$", "\\.boo$" ] ``` The above is a list of regular expressions. Note that the backslash (`\`) character is escaped in this example to keep TOML happy. -## Configuration Format Specs +## Configure Blackfriday Rendering + +[Blackfriday](https://github.com/russross/blackfriday) is Hugo's built-in +[Markdown](http://daringfireball.net/projects/markdown/) rendering engine. + +Hugo typically configures Blackfriday with sane default values. These defaults should fit most use cases reasonably well. + +However, if you have specific needs with respect to Markdown, Hugo exposes some of its Blackfriday behavior options for you to alter. The following table lists these Hugo options, paired with the corresponding flags from Blackfriday's source code ( [html.go](https://github.com/russross/blackfriday/blob/master/html.go) and [markdown.go](https://github.com/russross/blackfriday/blob/master/markdown.go)). + +{{< bfconfig >}} + +{{% note %}} +1. Blackfriday flags are **case sensitive** as of Hugo v0.15. +2. Blackfriday flags must be grouped under the `blackfriday` key and can be set on both the site level *and* the page level. Any setting on a page will override the site setting there. See [site configuration for more information](/content-management/front-matter/#override-global-blackfriday-configuration). +{{% /note %}} + +{{% input "bf-config.toml" %}} +```toml +[blackfriday] + angledQuotes = true + fractions = false + plainIDAnchors = true + extensions = ["hardLineBreak"] +``` +{{% /input %}} + +{{% input "bf-config.yml" %}} +```yaml +blackfriday: + angledQuotes: true + fractions: false + plainIDAnchors: true + extensions: + - hardLineBreak +``` +{{% /input %}} + + +## Specs for Configuration Formats * [TOML Spec][] * [YAML Spec][] diff --git a/content/getting-started/quick-start.md b/content/getting-started/quick-start.md index 5593ff56b..77236f224 100644 --- a/content/getting-started/quick-start.md +++ b/content/getting-started/quick-start.md @@ -599,7 +599,7 @@ git push [quickinstall]: /getting-started/install-hugo/#quick-install [releases]: https://github.com/spf13/hugo/releases [robusttheme]: https://github.com/dim0627/hugo_theme_robust -[section]: /content-management/content-sections/ +[section]: /content-management/sections/ [shortcodetemplates]: /templates/shortcode-templates/ [sitemenu]: /content-management/menus/ [templating]: /templates/ diff --git a/content/hosting-and-deployment/_index.md b/content/hosting-and-deployment/_index.md index 3188714e5..8399ab467 100644 --- a/content/hosting-and-deployment/_index.md +++ b/content/hosting-and-deployment/_index.md @@ -5,11 +5,10 @@ description: Site builds, automated deployments, and popular hosting solutions. date: 2016-11-01 publishdate: 2016-11-01 lastmod: 2016-11-01 -tags: [] categories: [hosting and deployment] +tags: [] weight: 01 draft: false -aliases: +aliases: [] toc: false -notesforauthors: --- \ No newline at end of file diff --git a/content/hosting-and-deployment/deployment-with-rsync.md b/content/hosting-and-deployment/deployment-with-rsync.md index 4c02a8c56..8a0b8088e 100644 --- a/content/hosting-and-deployment/deployment-with-rsync.md +++ b/content/hosting-and-deployment/deployment-with-rsync.md @@ -1,6 +1,6 @@ --- title: Deployment with Rysnc -linktitle: +linktitle: Deployment with Rysnc description: date: 2017-02-01 publishdate: 2017-02-01 @@ -8,7 +8,7 @@ lastmod: 2017-02-01 categories: [hosting and deployment] tags: [rysnc,deployment] authors: [Adrien Poupin] -weight: +weight: 10 draft: false aliases: [/tutorials/deployment-with-rsync/] toc: true diff --git a/content/hosting-and-deployment/deployment-with-wercker.md b/content/hosting-and-deployment/deployment-with-wercker.md index 0fd0e121e..c285d65a6 100644 --- a/content/hosting-and-deployment/deployment-with-wercker.md +++ b/content/hosting-and-deployment/deployment-with-wercker.md @@ -8,7 +8,7 @@ lastmod: 2017-02-01 categories: [hosting and deployment] tags: [wercker,deployment,github,git] authors: [Arjen Schwarz, Samuel Debruyn] -toc: false +weight: 20 draft: false aliases: [/tutorials/automated-deployments/] toc: true @@ -16,6 +16,8 @@ needsreview: false notesforauthors: --- +## Goals + By the end of this guide, you will have completed the following: * Creating a basic Hugo project and website @@ -88,7 +90,7 @@ Once the website is build, t's a good idea to run the following command to start hugo server --theme=herring-cove ``` -If everything is fine, you should see something similar to the image below when you go to in your browser. +If everything is fine, you should see something similar to the image below when you go to in your browser. ![][1] diff --git a/content/hosting-and-deployment/hosting-on-bitbucket.md b/content/hosting-and-deployment/hosting-on-bitbucket.md index 3051f087a..8b127da68 100644 --- a/content/hosting-and-deployment/hosting-on-bitbucket.md +++ b/content/hosting-and-deployment/hosting-on-bitbucket.md @@ -8,16 +8,13 @@ lastmod: 2017-02-04 categories: [hosting and deployment] tags: [hosting,bitbucket,deployment,aerobatic] authors: [Jason Gowans] -weight: +weight: 30 draft: false toc: true aliases: [/tutorials/hosting-on-bitbucket/] needsreview: true -notesforauthors: --- -## Introduction - You can use [Bitbucket](https://bitbucket.org/) and [Aerobatic](https://www.aerobatic.com) to build, deploy, and host a Hugo website. Aerobatic is a static hosting service that integrates with Bitbucket and provides a free hosting tier. ## Assumptions diff --git a/content/hosting-and-deployment/hosting-on-github.md b/content/hosting-and-deployment/hosting-on-github.md index b12b2faa5..2134c090f 100644 --- a/content/hosting-and-deployment/hosting-on-github.md +++ b/content/hosting-and-deployment/hosting-on-github.md @@ -8,46 +8,36 @@ lastmod: 2017-02-01 categories: [hosting and deployment] tags: [github,git,deployment,hosting] authors: [Spencer Lyon, Gunnar Morling] -weight: +weight: 40 draft: false toc: true aliases: [/tutorials/github-pages-blog/] needsreview: true -notesforauthors: --- {{% note %}} This hosting and deployment guide was originally contributed as a tutorial by [Spencer Lyon](http://spencerlyon.com/) and [Gunnar Morling](https://github.com/gunnarmorling/). {{% /note %}} -## Introduction +## Assumptions -This tutorial describes how to deploy your Hugo based website to [GitHub pages](https://pages.github.com/). +The following sections are based on the assumption that you are working with a "Project Pages Site". This means that you'll have your Hugo sources and the generated HTML output within a single repository (in contrast, with a "User/Organization Pages Site", you'd have one repo for the sources and another repo for the published HTML files; refer to the [GitHub Pages docs](https://help.github.com/articles/user-organization-and-project-pages/) to learn more). -The following sections are based on the assumption that you are working with a "Project Pages Site". -This means that you'll have your Hugo sources and the generated HTML output within a single repository -(in contrast, with a "User/Organization Pages Site", you'd have one repo for the sources and another repo for the published HTML files; -refer to the [GitHub Pages docs](https://help.github.com/articles/user-organization-and-project-pages/) to learn more). +## Deployment via `/docs` Folder on Master Branch -## Deployment via _/docs_ folder on master branch +[As described](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/#publishing-your-github-pages-site-from-a-docs-folder-on-your-master-branch) in the GitHub Pages docs, you can deploy from a folder called _docs_ on your master branch. This requires to change the Hugo publish directory in the site config (e.g. _config.toml_): -[As described](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/#publishing-your-github-pages-site-from-a-docs-folder-on-your-master-branch) in the GitHub Pages docs, you can deploy from a folder called _docs_ on your master branch. -This requires to change the Hugo publish directory in the site config (e.g. _config.toml_): +```sh +publishDir: "docs" +``` - publishDir: "docs" +After running `hugo`, push your master branch to the remote repo and choose the _docs_ folder as the website source of your repo (in your GitHub project, go to "Settings " -> "GitHub Pages" -> "Source" -> Select "master branch /docs folder"). If that option isn't enabled, you likely haven't pushed your _docs_ folder yet. -After running `hugo`, push your master branch to the remote repo and choose the _docs_ folder as the website source of your repo -(in your GitHub project, go to "Settings " -> "GitHub Pages" -> "Source" -> Select "master branch /docs folder"). -If that option isn't enabled, you likely haven't pushed your _docs_ folder yet. +This is the simplest approach but requires the usage of a non-standard publish directory (GitHub Pages cannot be configured to use another directory than _docs_ currently). Also the presence of generated files on the master branch may not be to eveyone's taste. -This is the simplest approach but requires the usage of a non-standard publish directory -(GitHub Pages cannot be configured to use another directory than _docs_ currently). -Also the presence of generated files on the master branch may not be to eveyone's taste. +## Deployment via `gh-pages` Branch -## Deployment via gh-pages branch - -Alternatively, you can deploy site through a separate branch called "gh_pages". -That approach is a bit more complex but has some advantages: +Alternatively, you can deploy site through a separate branch called "gh_pages". That approach is a bit more complex but has some advantages: * It keeps sources and generated HTML in two different branches * It uses the default _public_ folder @@ -55,18 +45,27 @@ That approach is a bit more complex but has some advantages: ### Preparations -These steps only need to be done once (replace "upstream" with the name of your remote, e.g. "origin"): +These steps only need to be done once (replace "upstream" with the name of your remote; e.g., `origin`): + +#### Add the Public Folder + First, add the _public_ folder to _.gitignore_ so it's ignored on the master branch: - echo "public" >> .gitignore +```bash +echo "public" >> .gitignore +``` + +#### Initialize Your `gh-pages` Branch Then initialize the gh-pages branch as an empty [orphan branch](https://git-scm.com/docs/git-checkout/#git-checkout---orphanltnewbranchgt): - git checkout --orphan gh-pages - git reset --hard - git commit --allow-empty -m "Initializing gh-pages branch" - git push upstream gh-pages - git checkout master +```bash +git checkout --orphan gh-pages +git reset --hard +git commit --allow-empty -m "Initializing gh-pages branch" +git push upstream gh-pages +git checkout master +``` ### Building and Deployment @@ -78,12 +77,16 @@ Now check out the gh-pages branch into your _public_ folder, using git's [worktr Regenerate the site using Hugo and commit the generated files on the gh-pages branch: - hugo - cd public && git add --all && git commit -m "Publishing to gh-pages" & cd .. +```bash +hugo +cd public && git add --all && git commit -m "Publishing to gh-pages" & cd .. +``` If the changes in your local gh-pages branch look alright, push them to the remote repo: - git push upstream gh-pages +```bash +git push upstream gh-pages +``` After a short while you'll see the updated contents on your GitHub Pages site. @@ -91,7 +94,7 @@ After a short while you'll see the updated contents on your GitHub Pages site. To automate these steps, you can create a script _scripts/publish_to_ghpages.sh_ with the following contents: -``` +```sh #!/bin/sh DIR=$(dirname "$0") @@ -126,16 +129,19 @@ cd public && git add --all && git commit -m "Publishing to gh-pages (publish.sh) This will abort if there are pending changes in the working directory and also makes sure that all previously existing output files are removed. Adjust the script to taste, e.g. to include the final push to the remote repository if you don't need to take a look at the gh-pages branch before pushing. Or adding `echo yourdomainname.com >> CNAME` if you set up for your gh-pages to use customize domain. -## Deployment with Git 2.4 and earlier +## Deployment with Git 2.4 and Earlier -The `worktree` command was only introduced in Git 2.5. -If you are still on an earlier version and cannot update, you can simply clone your local repo into the _public_ directory, only keeping the gh-pages branch: +The `worktree` command was only introduced in Git 2.5. If you are still on an earlier version and cannot update, you can simply clone your local repo into the _public_ directory, only keeping the gh-pages branch: - git clone .git --branch gh-pages public +```sh +git clone .git --branch gh-pages public +``` Having re-generated the site, you'd push back the gh-pages branch to your primary local repo: - cd public && git add --all && git commit -m "Publishing to gh-pages" && git push origin gh-pages +```sh +cd public && git add --all && git commit -m "Publishing to gh-pages" && git push origin gh-pages +``` The other steps are the same as with the worktree approach. @@ -143,8 +149,8 @@ The other steps are the same as with the worktree approach. As mentioned [in this GitHub's article](https://help.github.com/articles/user-organization-and-project-pages/), besides project pages, you may also want to host a user/organization page. Here are the key differences: -> - You must use the `username.github.io` naming scheme. -> - Content from the `master` branch will be used to build and publish your GitHub Pages site. +1. You must use the `username.github.io` naming scheme. +2. Content from the `master` branch will be used to build and publish your GitHub Pages site. It becomes much simpler in that case: we'll create two separate repos, one for Hugo's content, and a git submodule with the `public` folder's content in it. @@ -158,7 +164,7 @@ It becomes much simpler in that case: we'll create two separate repos, one for H 6. `git submodule add -b master git@github.com:/.github.io.git public` 7. Almost done: add a `deploy.sh` script to help you (and make it executable: `chmod +x deploy.sh`): -``` +```sh #!/bin/bash echo -e "\033[0;32mDeploying updates to GitHub...\033[0m" @@ -186,11 +192,10 @@ cd .. ``` 7. `./deploy.sh "Your optional commit message"` to send changes to `.github.io` (careful, you may also want to commit changes on the `-hugo` repo). -That's it! Your personal page is running at [http://username.github.io/](http://username.github.io/) (after up to 10 minutes delay). +That's it! Your personal page is running at [http://username.github.io/](http://username.github.io/)(after up to 10 minutes delay). -## Using a custom domain +## Using a Custom Domain -If you'd like to use a custom domain for your GitHub Pages site, create a file _static/CNAME_ with the domain name as its sole contents. -This will put the CNAME file to the root of the published site as required by GitHub Pages. +If you'd like to use a custom domain for your GitHub Pages site, create a file _static/CNAME_ with the domain name as its sole contents. This will put the CNAME file to the root of the published site as required by GitHub Pages. Refer to the [official documentation](https://help.github.com/articles/using-a-custom-domain-with-github-pages/) for further information. \ No newline at end of file diff --git a/content/hosting-and-deployment/hosting-on-gitlab.md b/content/hosting-and-deployment/hosting-on-gitlab.md index 91f69cd35..33fda4f92 100644 --- a/content/hosting-and-deployment/hosting-on-gitlab.md +++ b/content/hosting-and-deployment/hosting-on-gitlab.md @@ -8,21 +8,19 @@ lastmod: 2016-06-23 categories: [hosting and deployment] tags: [hosting,deployment,git,gitlab] authors: [Riku-Pekka Silvola] -weight: +weight: 50 draft: false toc: true -needsreview: true +needsreview: false aliases: [/tutorials/hosting-on-gitlab/] -notesforauthors: --- - -[GitLab](https://gitlab.com/) makes it incredibly easy to build, deploy, and host your Hugo website. +[GitLab](https://gitlab.com/) makes it incredibly easy to build, deploy, and host your Hugo website via their free GitLab Pages service, which provides [native support for Hugo, as well as numerous other static site generators](https://gitlab.com/pages/hugo). ## Assumptions * Working familiarity with Git for version control -* Completion of the [Quick Start][quickstart] +* Completion of the Hugo [Quick Start][] * A [GitLab account](https://gitlab.com/users/sign_in) * A Hugo website on your local machine that you are ready to publish @@ -34,6 +32,7 @@ cd your-hugo-site In the root directory of your Hugo site, create a `.gitlab-ci.yml` file. The `.gitlab-ci.yml` configures the GitLab CI on how to build your page. Simply add the content below. +{{% input "gitlab-ci.yml" %}} ```yml image: publysher/hugo @@ -46,10 +45,11 @@ pages: only: - master ``` +{{% /input %}} ## Push Your Hugo Website to GitLab -Next up, create a new repository on GitLab. It is *not* necessary to set the repository public. In addition, you might want to add `/public` to your .gitignore file, as there is no need to push compiled assets to GitLab. +Next, create a new repository on GitLab. It is *not* necessary to make the repository public. In addition, you might want to add `/public` to your .gitignore file, as there is no need to push compiled assets to GitLab or keep your output website in version control. ```bash # initialize new git repository @@ -65,14 +65,14 @@ git remote add origin https://gitlab.com/YourUsername/your-hugo-site.git git push -u origin master ``` -## Wait for Your Page to be Built +## Wait for Your Page to Build -That's it! You can now follow the CI agent building your page at https://gitlab.com/YourUsername/your-hugo-site/pipelines. +That's it! You can now follow the CI agent building your page at https://gitlab.com///pipelines. -After the build has passed, your new website is available at `https://YourUsername.gitlab.io/your-hugo-site/`. +After the build has passed, your new website is available at `https://.gitlab.io//`. ## Next Steps -GitLab supports using custom CNAME's and TLS certificates. For more details on GitLab Pages, see [https://about.gitlab.com/2016/04/07/gitlab-pages-setup/](https://about.gitlab.com/2016/04/07/gitlab-pages-setup/). +GitLab supports using custom CNAME's and TLS certificates. For more details on GitLab Pages, see the [GitLab Pages setup documentation](https://about.gitlab.com/2016/04/07/gitlab-pages-setup/). -[quickstart]: /getting-started/quick-start/ \ No newline at end of file +[Quick Start]: /getting-started/quick-start/ \ No newline at end of file diff --git a/content/showcase/2626info.md b/content/showcase/2626info.md index a652ea6c4..53a6dd5c6 100644 --- a/content/showcase/2626info.md +++ b/content/showcase/2626info.md @@ -7,7 +7,7 @@ sitelink: http://2626.info/ tags: - personal - blog -image: 2626info-tn.png +image: 2626info.png title: 2626.info --- diff --git a/content/showcase/antzucaro.md b/content/showcase/antzucaro.md index 6aabf473b..f60d96730 100644 --- a/content/showcase/antzucaro.md +++ b/content/showcase/antzucaro.md @@ -10,7 +10,7 @@ tags: - personal - blog - foundation -image: antzucaro-tn.jpg +image: antzucaro.jpg title: Ant Zucaro --- diff --git a/content/showcase/appernetic.md b/content/showcase/appernetic.md index 77c9d9209..665579cf8 100644 --- a/content/showcase/appernetic.md +++ b/content/showcase/appernetic.md @@ -10,6 +10,6 @@ tags: - company - blog - bootstrap -image: apperneticioblog.png +image: apperneticioblog.png title: Appernetic --- diff --git a/content/showcase/arresteddevops.md b/content/showcase/arresteddevops.md index 45fcf3f69..7ae0cccad 100644 --- a/content/showcase/arresteddevops.md +++ b/content/showcase/arresteddevops.md @@ -9,6 +9,6 @@ sourcelink: https://github.com/arresteddevops/ado-hugo tags: - podcast - bootstrap -image: arresteddevops-tn.png +image: arresteddevops.png title: arresteddevops --- diff --git a/content/showcase/asc.md b/content/showcase/asc.md index 10fc20226..d6b0eaca7 100644 --- a/content/showcase/asc.md +++ b/content/showcase/asc.md @@ -9,7 +9,7 @@ sourcelink: https://gitlab.com/acodispo/andrewcodispoti-com tags: - personal - bootstrap -image: asc-tn.jpg +image: asc.jpg title: Andrew S Codispoti --- diff --git a/content/showcase/astrochili.md b/content/showcase/astrochili.md index 7ce26209c..c54c102f9 100644 --- a/content/showcase/astrochili.md +++ b/content/showcase/astrochili.md @@ -8,7 +8,7 @@ sourcelink: https://github.com/astrochili/astrochili.github.io tags: - personal - blog -image: astrochili-tn.png +image: astrochili.png title: Roman Silin --- diff --git a/content/showcase/aydoscom.md b/content/showcase/aydoscom.md index 28d8bad4c..0ccd0caed 100644 --- a/content/showcase/aydoscom.md +++ b/content/showcase/aydoscom.md @@ -6,7 +6,7 @@ licenseLink: "" sitelink: https://aydos.com/ tags: - web applications -image: aydoscom.png +image: aydoscom.png title: aydos.com --- diff --git a/content/showcase/barricade.md b/content/showcase/barricade.md index 5c1218fed..5aa86bb88 100644 --- a/content/showcase/barricade.md +++ b/content/showcase/barricade.md @@ -7,7 +7,7 @@ sitelink: https://barricade.io tags: - company - security -image: barricade-tn.png +image: barricade.png title: Barricade --- diff --git a/content/showcase/bepsays.md b/content/showcase/bepsays.md index 4d37188ed..9fc6596de 100644 --- a/content/showcase/bepsays.md +++ b/content/showcase/bepsays.md @@ -9,7 +9,7 @@ sourcelink: "https://github.com/bep/bepsays.com" tags: - personal - blog -image: bepsays-tn.png +image: bepsays.png title: bepsays.com --- diff --git a/content/showcase/bugtrackers.io.md b/content/showcase/bugtrackers.io.md index 53c8206c8..4e916f191 100644 --- a/content/showcase/bugtrackers.io.md +++ b/content/showcase/bugtrackers.io.md @@ -7,7 +7,7 @@ tags: - blog - community - interviews -image: bugtrackersio-tn.jpg +image: bugtrackersio.jpg title: bugtrackers.io --- diff --git a/content/showcase/camunda-blog.md b/content/showcase/camunda-blog.md index d2a260247..d77ec530d 100644 --- a/content/showcase/camunda-blog.md +++ b/content/showcase/camunda-blog.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/camunda/blog.camunda.org tags: - company - blog -image: camunda-blog.png +image: camunda-blog.png title: Camunda Blog --- diff --git a/content/showcase/camunda-docs.md b/content/showcase/camunda-docs.md index 4a3570f85..47508801e 100644 --- a/content/showcase/camunda-docs.md +++ b/content/showcase/camunda-docs.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/camunda/camunda-docs-theme tags: - company - documentation -image: camunda-docs.png +image: camunda-docs.png title: Camunda Docs --- diff --git a/content/showcase/cdnoverview.md b/content/showcase/cdnoverview.md index 12976a098..79973d330 100644 --- a/content/showcase/cdnoverview.md +++ b/content/showcase/cdnoverview.md @@ -8,7 +8,7 @@ tags: - bootstrap - portfolio - tech -image: cdnoverview-tn.png +image: cdnoverview.png title: cdnoverview.com --- diff --git a/content/showcase/chinese-grammar.md b/content/showcase/chinese-grammar.md index 6b5fc05e1..6400c0991 100644 --- a/content/showcase/chinese-grammar.md +++ b/content/showcase/chinese-grammar.md @@ -7,6 +7,6 @@ sourcelink: https://github.com/hughgrigg/chineseboost-articles tags: - learning - education -image: chinese-grammar-tn.png +image: chinese-grammar.png title: Chinese Grammar --- diff --git a/content/showcase/chingli.md b/content/showcase/chingli.md index e83db9b46..0c9a5a58b 100644 --- a/content/showcase/chingli.md +++ b/content/showcase/chingli.md @@ -6,7 +6,7 @@ sitelink: http://www.chingli.com/ tags: - personal - blog -image: chingli-tn.jpg +image: chingli.jpg title: 青砾 (chingli) --- diff --git a/content/showcase/chipsncookies.md b/content/showcase/chipsncookies.md index 36d8f92c6..c32f597e1 100644 --- a/content/showcase/chipsncookies.md +++ b/content/showcase/chipsncookies.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/SamuelDebruyn/chipsncookies-site tags: - personal - blog -image: chipsncookies-tn.png +image: chipsncookies.png title: Chips 'n' Cookies --- diff --git a/content/showcase/christianmendoza.md b/content/showcase/christianmendoza.md index 42091722f..6edf9af20 100644 --- a/content/showcase/christianmendoza.md +++ b/content/showcase/christianmendoza.md @@ -7,6 +7,6 @@ sitelink: https://christianmendoza.me/ tags: - personal - profile -image: christianmendoza-tn.png +image: christianmendoza.png title: christianmendoza.me --- diff --git a/content/showcase/cinegyopen.md b/content/showcase/cinegyopen.md index 4b8bbbe05..f87f44a54 100644 --- a/content/showcase/cinegyopen.md +++ b/content/showcase/cinegyopen.md @@ -7,6 +7,6 @@ sitelink: https://open.cinegy.com/ sourcelink: tags: - documentation -image: cinegyopen-tn.png +image: cinegyopen.png title: Cinegy Open --- \ No newline at end of file diff --git a/content/showcase/clearhaus.md b/content/showcase/clearhaus.md index 7ebf32284..a151bc96a 100644 --- a/content/showcase/clearhaus.md +++ b/content/showcase/clearhaus.md @@ -9,6 +9,6 @@ tags: - fintech - payments - acquirer -image: clearhaus-tn.png +image: clearhaus.png title: Clearhaus --- diff --git a/content/showcase/cloudshark.md b/content/showcase/cloudshark.md index 674d066f4..acd588abc 100644 --- a/content/showcase/cloudshark.md +++ b/content/showcase/cloudshark.md @@ -9,7 +9,7 @@ tags: - company - documentation - foundation -image: cloudshark-tn.jpg +image: cloudshark.jpg title: CloudShark --- diff --git a/content/showcase/coding-journal.md b/content/showcase/coding-journal.md index 7e2cc175e..561adbe50 100644 --- a/content/showcase/coding-journal.md +++ b/content/showcase/coding-journal.md @@ -9,6 +9,6 @@ sourcelink: https://github.com/igorkulman/coding-journal tags: - blog - portfolio -image: codingjournal-tn.png +image: codingjournal.png title: Coding Journal --- diff --git a/content/showcase/consequently.md b/content/showcase/consequently.md index da48170ba..2b42746c1 100644 --- a/content/showcase/consequently.md +++ b/content/showcase/consequently.md @@ -10,7 +10,7 @@ tags: - academic - blog - kube -image: consequently.jpg +image: consequently.jpg title: consequently.org --- diff --git a/content/showcase/ctlcompiled.md b/content/showcase/ctlcompiled.md index ef050fe8e..295e376be 100644 --- a/content/showcase/ctlcompiled.md +++ b/content/showcase/ctlcompiled.md @@ -8,7 +8,7 @@ tags: - edtech - technology - blog -image: ctlcompiled-tn.png +image: ctlcompiled.png title: CompilED at CTL --- diff --git a/content/showcase/danmux.md b/content/showcase/danmux.md index d05b974f8..a82bc4ddd 100644 --- a/content/showcase/danmux.md +++ b/content/showcase/danmux.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/danmux/danmux-hugo tags: - personal - blog -image: danmux-tn.jpg +image: danmux.jpg title: Danmux --- diff --git a/content/showcase/datapipelinearchitect.md b/content/showcase/datapipelinearchitect.md index cbcace446..0db104502 100644 --- a/content/showcase/datapipelinearchitect.md +++ b/content/showcase/datapipelinearchitect.md @@ -7,7 +7,7 @@ tags: - tech - blog - website -image: datapipelinearchitect-tn.jpg +image: datapipelinearchitect.jpg title: Data Pipeline Architect --- diff --git a/content/showcase/davidepetilli.md b/content/showcase/davidepetilli.md index 7fc78b18b..415dc6222 100644 --- a/content/showcase/davidepetilli.md +++ b/content/showcase/davidepetilli.md @@ -10,7 +10,7 @@ tags: - photography - portfolio - blog -image: davidepetilli-tn.jpg +image: davidepetilli.jpg title: Davide Petilli --- diff --git a/content/showcase/davidrallen.md b/content/showcase/davidrallen.md index aae51875b..cca6d5a80 100644 --- a/content/showcase/davidrallen.md +++ b/content/showcase/davidrallen.md @@ -9,7 +9,7 @@ tags: - personal - blog - tech -image: davidrallen-tn.png +image: davidrallen.png title: David Allen --- diff --git a/content/showcase/davidyates.md b/content/showcase/davidyates.md index 9717870b9..9c7a2677b 100644 --- a/content/showcase/davidyates.md +++ b/content/showcase/davidyates.md @@ -7,7 +7,7 @@ sitelink: https://davidyat.es/ tags: - personal - blog -image: davidyates-tn.png +image: davidyates.png title: David Yates --- diff --git a/content/showcase/devmonk.md b/content/showcase/devmonk.md index 79073559b..1128199f8 100644 --- a/content/showcase/devmonk.md +++ b/content/showcase/devmonk.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/peteraba/devmonk.com tags: - educational - video -image: devmonk-tn.jpg +image: devmonk.jpg title: devmonk --- diff --git a/content/showcase/dmitriid.com.md b/content/showcase/dmitriid.com.md index 7afe1c40a..bc2c86cb2 100644 --- a/content/showcase/dmitriid.com.md +++ b/content/showcase/dmitriid.com.md @@ -8,7 +8,7 @@ sourcelink: https://github.com/dmitriid/dmitriid.com tags: - personal - blog -image: dmitriid.com.png +image: dmitriid.com.png title: dmitriid.com --- diff --git a/content/showcase/emilyhorsman.com.md b/content/showcase/emilyhorsman.com.md index ab1baada7..c45029265 100644 --- a/content/showcase/emilyhorsman.com.md +++ b/content/showcase/emilyhorsman.com.md @@ -7,7 +7,7 @@ sourcelink: https://github.com/emilyhorsman/buttercup tags: - personal - blog -image: emilyhorsman.com-tn.jpg +image: emilyhorsman.com.jpg title: emilyhorsman.com --- diff --git a/content/showcase/esolia-com.md b/content/showcase/esolia-com.md index 8d97c0172..8df4a73b2 100644 --- a/content/showcase/esolia-com.md +++ b/content/showcase/esolia-com.md @@ -11,6 +11,6 @@ tags: - esolia - rickcogley - japan -image: esolia_com-tn.png +image: esolia_com.png title: eSolia.com --- diff --git a/content/showcase/esolia-pro.md b/content/showcase/esolia-pro.md index a573efb5b..8711a24a6 100644 --- a/content/showcase/esolia-pro.md +++ b/content/showcase/esolia-pro.md @@ -11,6 +11,6 @@ tags: - esolia - rickcogley - japan -image: esolia_pro-tn.png +image: esolia_pro.png title: eSolia.pro --- diff --git a/content/showcase/eurie.md b/content/showcase/eurie.md index de7010b56..7e89d26de 100644 --- a/content/showcase/eurie.md +++ b/content/showcase/eurie.md @@ -6,6 +6,6 @@ licenseLink: "" sitelink: https://docs.eurie.io tags: - documentation -image: docs.eurie.io-tn.png +image: docs.eurie.io.png title: eurie Desk docs --- diff --git a/content/showcase/fale.md b/content/showcase/fale.md index 86dc402ed..3a0f44d8c 100644 --- a/content/showcase/fale.md +++ b/content/showcase/fale.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/fale/fale.io tags: - personal - blog -image: fale-tn.png +image: fale.png title: fale.io --- diff --git a/content/showcase/fixatom.md b/content/showcase/fixatom.md index d341a9a26..faa4e4343 100644 --- a/content/showcase/fixatom.md +++ b/content/showcase/fixatom.md @@ -7,7 +7,7 @@ sitelink: https://fixatom.com/ tags: - personal - blog -image: fixatom-tn.png +image: fixatom.png title: Atom --- diff --git a/content/showcase/fxsitecompat.md b/content/showcase/fxsitecompat.md index 05d24640e..99800329d 100644 --- a/content/showcase/fxsitecompat.md +++ b/content/showcase/fxsitecompat.md @@ -10,7 +10,7 @@ tags: - community - documentation - translation -image: fxsitecompat-tn.png +image: fxsitecompat.png title: Firefox Site Compatibility --- diff --git a/content/showcase/gntech.md b/content/showcase/gntech.md index ed5e92109..763d7a219 100644 --- a/content/showcase/gntech.md +++ b/content/showcase/gntech.md @@ -10,6 +10,6 @@ tags: - projects - music - drawings -image: gntech-tn.png +image: gntech.png title: gntech.se --- diff --git a/content/showcase/gogb.md b/content/showcase/gogb.md index 56cfab6b4..e8e4c3733 100644 --- a/content/showcase/gogb.md +++ b/content/showcase/gogb.md @@ -7,7 +7,7 @@ licenseLink: "" sitelink: http://getgb.io tags: - project -image: gogb-tn.jpg +image: gogb.jpg title: GoGB --- diff --git a/content/showcase/goin5minutes.md b/content/showcase/goin5minutes.md index 4646cb942..38f4d8739 100644 --- a/content/showcase/goin5minutes.md +++ b/content/showcase/goin5minutes.md @@ -8,6 +8,6 @@ sitelink: http://www.goin5minutes.com/ sourcelink: https://github.com/arschles/go-in-5-minutes/tree/master/www tags: - screencasts -image: goin5minutes-tn.png +image: goin5minutes.png title: Go in 5 minutes --- \ No newline at end of file diff --git a/content/showcase/h10n.me.md b/content/showcase/h10n.me.md index 24a86feac..d1ae5b7ab 100644 --- a/content/showcase/h10n.me.md +++ b/content/showcase/h10n.me.md @@ -6,6 +6,6 @@ sourcelink: https://github.com/zerok/h10n.me tags: - personal - profile -image: h10n.me-tn.png +image: h10n.me.png title: h10n.me --- diff --git a/content/showcase/hugo.md b/content/showcase/hugo.md index 7cdc902d0..e7912c42d 100644 --- a/content/showcase/hugo.md +++ b/content/showcase/hugo.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/spf13/hugo/tree/master/docs tags: - documentation - bootstrap -image: hugo-tn.jpg +image: hugo.jpg title: Hugo --- diff --git a/content/showcase/jamescampbell.md b/content/showcase/jamescampbell.md index 5a254ca98..a9373beef 100644 --- a/content/showcase/jamescampbell.md +++ b/content/showcase/jamescampbell.md @@ -8,7 +8,7 @@ sourcelink: https://github.com/jamesacampbell/causes-and-effects-hugo tags: - personal - blog -image: jamescampbell-tn.png +image: jamescampbell.png title: jamescampbell.us --- diff --git a/content/showcase/jorgennilsson.md b/content/showcase/jorgennilsson.md index 3ec280380..e543576d7 100644 --- a/content/showcase/jorgennilsson.md +++ b/content/showcase/jorgennilsson.md @@ -7,6 +7,6 @@ sitelink: http://jorgennilsson.com/ tags: - personal - blog -image: jorgennilsson-tn.png +image: jorgennilsson.png title: jorgennilsson.com --- diff --git a/content/showcase/kieranhealy.md b/content/showcase/kieranhealy.md index 597f8351e..2672569fb 100644 --- a/content/showcase/kieranhealy.md +++ b/content/showcase/kieranhealy.md @@ -10,7 +10,7 @@ tags: - personal - blog - academic -image: kjhealy-tn.jpg +image: kjhealy.jpg title: Kieran Healy --- diff --git a/content/showcase/klingt-net.md b/content/showcase/klingt-net.md index a5c0ce9bc..6b1a34520 100644 --- a/content/showcase/klingt-net.md +++ b/content/showcase/klingt-net.md @@ -9,7 +9,7 @@ tags: - personal - blog - programming -image: klingt-net-tn.png +image: klingt-net.png title: klingt net --- diff --git a/content/showcase/launchcode5.md b/content/showcase/launchcode5.md index fe5d8850f..55be17af6 100644 --- a/content/showcase/launchcode5.md +++ b/content/showcase/launchcode5.md @@ -8,7 +8,7 @@ sitelink: http://www.launchcode5.com/ sourcelink: https://github.com/Launchcode5/launchcode5.com tags: - bootstrap -image: launchcode-tn.jpg +image: launchcode.jpg title: Launchcode Software Studios --- diff --git a/content/showcase/leepenney.md b/content/showcase/leepenney.md index 2830cfacc..c903bac7b 100644 --- a/content/showcase/leepenney.md +++ b/content/showcase/leepenney.md @@ -8,7 +8,7 @@ sitelink: http://leepenney.com/ tags: - personal - website -image: leepenney-tn.jpg +image: leepenney.jpg title: Lee Penney --- diff --git a/content/showcase/leowkahman.md b/content/showcase/leowkahman.md index 95fd589ab..bacaa97cd 100644 --- a/content/showcase/leowkahman.md +++ b/content/showcase/leowkahman.md @@ -7,6 +7,6 @@ sitelink: https://www.leowkahman.com/ tags: - personal - blog -image: leowkahman-tn.png +image: leowkahman.png title: Leow Kah Man - Tech Blog --- \ No newline at end of file diff --git a/content/showcase/lk4d4.darth.io.md b/content/showcase/lk4d4.darth.io.md index 0c56364d2..c9563d232 100644 --- a/content/showcase/lk4d4.darth.io.md +++ b/content/showcase/lk4d4.darth.io.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/LK4D4/lk4d4.darth.io tags: - personal - blog -image: lk4d4-tn.jpg +image: lk4d4.jpg title: lk4d4.darth.io --- diff --git a/content/showcase/losslesslife.md b/content/showcase/losslesslife.md index 402200f36..cb0b6017b 100644 --- a/content/showcase/losslesslife.md +++ b/content/showcase/losslesslife.md @@ -10,6 +10,6 @@ tags: - reviews - education - audiophile -image: losslesslife-tn.png +image: losslesslife.png title: LosslessLife --- diff --git a/content/showcase/mariosanchez.md b/content/showcase/mariosanchez.md index 7d3f61f64..321d5f25f 100644 --- a/content/showcase/mariosanchez.md +++ b/content/showcase/mariosanchez.md @@ -9,6 +9,6 @@ sourcelink: https://github.com/mariobox/Hugo-Source tags: - personal - blog -image: mariosanchez-tn.jpg +image: mariosanchez.jpg title: mariosanchez.org --- diff --git a/content/showcase/mayan-edms.md b/content/showcase/mayan-edms.md index 2cf00c43a..08edf559d 100644 --- a/content/showcase/mayan-edms.md +++ b/content/showcase/mayan-edms.md @@ -8,7 +8,7 @@ sourcelink: https://gitlab.com/mayan-edms/website tags: - paperless - floss -image: mayan-edms-tn.png +image: mayan-edms.png title: Mayan EDMS --- diff --git a/content/showcase/michaelwhatcott.md b/content/showcase/michaelwhatcott.md index 28894e115..7138fdd25 100644 --- a/content/showcase/michaelwhatcott.md +++ b/content/showcase/michaelwhatcott.md @@ -9,7 +9,7 @@ sourcelink: https://bitbucket.org/mdwhatcott/michaelwhatcott.com-boilerplate/src tags: - personal - blog -image: michaelwhatcott-tn.jpg +image: michaelwhatcott.jpg title: michaelwhatcott --- diff --git a/content/showcase/mongodb-eng-journal.md b/content/showcase/mongodb-eng-journal.md index a8dd1e1a4..f82cc5b97 100644 --- a/content/showcase/mongodb-eng-journal.md +++ b/content/showcase/mongodb-eng-journal.md @@ -7,7 +7,7 @@ sitelink: http://engineering.mongodb.com/ tags: - engineering - blog -image: mongodb-eng-tn.png +image: mongodb-eng.png title: The Mongodb Engineering Journal --- diff --git a/content/showcase/mtbhomer.md b/content/showcase/mtbhomer.md index 35269503e..32e233eed 100644 --- a/content/showcase/mtbhomer.md +++ b/content/showcase/mtbhomer.md @@ -9,6 +9,6 @@ tags: - personal - portfolio - design -image: mtbhomer-tn.png +image: mtbhomer.png title: mtbhomer.com --- diff --git a/content/showcase/nickoneill.md b/content/showcase/nickoneill.md index 8ba96eb6a..4eca4602e 100644 --- a/content/showcase/nickoneill.md +++ b/content/showcase/nickoneill.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/nickoneill/blog.nickoneill.name tags: - personal - blog -image: nickoneill-tn.jpg +image: nickoneill.jpg title: authenticgeek --- diff --git a/content/showcase/ninjaducks.in.md b/content/showcase/ninjaducks.in.md index 880186eb5..d3b70bbd6 100644 --- a/content/showcase/ninjaducks.in.md +++ b/content/showcase/ninjaducks.in.md @@ -9,6 +9,6 @@ sourcelink: https://github.com/shivanshuag/shivanshuag.github.io/tree/new tags: - personal - blog -image: ninjaducks-tn.png +image: ninjaducks.png title: ninjaducks.in --- diff --git a/content/showcase/ninya.io.md b/content/showcase/ninya.io.md index d8c147838..be982f7fb 100644 --- a/content/showcase/ninya.io.md +++ b/content/showcase/ninya.io.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/ninya-io/ninya-io.github.io/tree/dev tags: - project - blog -image: ninya-tn.jpg +image: ninya.jpg title: ninya.io --- diff --git a/content/showcase/nodesk.md b/content/showcase/nodesk.md index 1f762f612..b835bd014 100644 --- a/content/showcase/nodesk.md +++ b/content/showcase/nodesk.md @@ -6,6 +6,6 @@ sitelink: http://nodesk.co/ tags: - digital nomad - web -image: nodesk-tn.png +image: nodesk.png title: nodesk.co --- diff --git a/content/showcase/novelist-xyz.md b/content/showcase/novelist-xyz.md index 989d1bc34..f26ff56af 100644 --- a/content/showcase/novelist-xyz.md +++ b/content/showcase/novelist-xyz.md @@ -8,6 +8,6 @@ sourcelink: https://github.com/peterychuang/peterychuang.github.io/tree/source tags: - personal - blog -image: novelist-xyz.png +image: novelist-xyz.png title: Peter Y. Chuang --- diff --git a/content/showcase/npf.md b/content/showcase/npf.md index d4c4f6d2e..7916b2b4f 100644 --- a/content/showcase/npf.md +++ b/content/showcase/npf.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/natefinch/npf tags: - personal - blog -image: npf-tn.jpg +image: npf.jpg title: npf.io --- diff --git a/content/showcase/peteraba.md b/content/showcase/peteraba.md index 2882ee938..503edd48d 100644 --- a/content/showcase/peteraba.md +++ b/content/showcase/peteraba.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/peteraba/peteraba.com tags: - personal - blog -image: peteraba-tn.jpg +image: peteraba.jpg title: peteraba --- diff --git a/content/showcase/promotive.md b/content/showcase/promotive.md new file mode 100644 index 000000000..a76e1d488 --- /dev/null +++ b/content/showcase/promotive.md @@ -0,0 +1,15 @@ +--- +date: 2017-02-21T12:26:26+01:00 +description: "Corporate website a event management agency" +license: "" +licenseLink: "" +sitelink: https://promotive.es +tags: +- company +- corporate +- spanish +- event management +- bootstrap +thumbnail: /img/promotive.png +title: Promotive +--- \ No newline at end of file diff --git a/content/showcase/rahulrai.md b/content/showcase/rahulrai.md index cfa600b38..0ade3438e 100644 --- a/content/showcase/rahulrai.md +++ b/content/showcase/rahulrai.md @@ -8,6 +8,6 @@ sourcelink: https://github.com/moonytheloony/Blog-Web tags: - personal - blog -image: rahulrai_in-tn.png +image: rahulrai_in.png title: My Take on Cloud --- diff --git a/content/showcase/rakutentech.md b/content/showcase/rakutentech.md index ca01ef47b..c7a7ac1a4 100644 --- a/content/showcase/rakutentech.md +++ b/content/showcase/rakutentech.md @@ -8,7 +8,7 @@ sitelink: http://techblog.rakuten.co.jp/ tags: - company - blog -image: rakutentech-tn.png +image: rakutentech.png title: Rakuten Tech Blog --- diff --git a/content/showcase/rdegges.md b/content/showcase/rdegges.md index 815668681..3d5bfbc4b 100644 --- a/content/showcase/rdegges.md +++ b/content/showcase/rdegges.md @@ -8,7 +8,7 @@ sourcelink: https://github.com/rdegges/rdegges-www tags: - personal - blog -image: rdegges-tn.png +image: rdegges.png title: Randall Degges --- diff --git a/content/showcase/readtext.md b/content/showcase/readtext.md index 742f20879..ae708d386 100644 --- a/content/showcase/readtext.md +++ b/content/showcase/readtext.md @@ -6,7 +6,7 @@ sitelink: http://readtext.org/ tags: - textfiles - reading -image: readtext-tn.png +image: readtext.png title: ReadText --- diff --git a/content/showcase/richardsumilang.md b/content/showcase/richardsumilang.md index aa94061c5..cc85833c9 100644 --- a/content/showcase/richardsumilang.md +++ b/content/showcase/richardsumilang.md @@ -12,6 +12,6 @@ tags: - technical - electronics - reviews -image: richardsumilang-tn.png +image: richardsumilang.png title: Richard Sumilang - Top Secret Labs --- diff --git a/content/showcase/rick-cogley-info.md b/content/showcase/rick-cogley-info.md index f3e69677b..30ce7ee20 100644 --- a/content/showcase/rick-cogley-info.md +++ b/content/showcase/rick-cogley-info.md @@ -11,6 +11,6 @@ tags: - blog - rickcogley - japan -image: rick_cogley_info-tn.jpg +image: rick_cogley_info.jpg title: rick.cogley.info --- diff --git a/content/showcase/ridingbytes.md b/content/showcase/ridingbytes.md index ef52195a2..7117fb430 100644 --- a/content/showcase/ridingbytes.md +++ b/content/showcase/ridingbytes.md @@ -10,7 +10,7 @@ tags: - website - blog - tech -image: ridingbytes-tn.png +image: ridingbytes.png title: RIDING BYTES --- diff --git a/content/showcase/robertbasic.md b/content/showcase/robertbasic.md index 0c44cc08c..124742a54 100644 --- a/content/showcase/robertbasic.md +++ b/content/showcase/robertbasic.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/robertbasic/robertbasic.com-hugo tags: - personal - blog -image: robertbasic-tn.jpg +image: robertbasic.jpg title: Robert Basic's blog --- diff --git a/content/showcase/scottcwilson.md b/content/showcase/scottcwilson.md index 12af3b958..6deb6677b 100644 --- a/content/showcase/scottcwilson.md +++ b/content/showcase/scottcwilson.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/scottcwilson/hugosite tags: - personal - blog -image: scottcwilson-tn.png +image: scottcwilson.png title: scottcwilson.com --- diff --git a/content/showcase/shapeshed.md b/content/showcase/shapeshed.md index 43184a137..adab0ba5c 100644 --- a/content/showcase/shapeshed.md +++ b/content/showcase/shapeshed.md @@ -8,7 +8,7 @@ sourcelink: https://github.com/shapeshed/shapeshed.com tags: - personal - blog -image: shapeshed-tn.png +image: shapeshed.png title: shapeshed.com --- diff --git a/content/showcase/shelan.md b/content/showcase/shelan.md index f87443adf..515bfb19f 100644 --- a/content/showcase/shelan.md +++ b/content/showcase/shelan.md @@ -9,6 +9,6 @@ sourcelink: https://github.com/shelan/my-hugo-site tags: - personal - blog -image: shelan-tn.png +image: shelan.png title: shelan.org --- \ No newline at end of file diff --git a/content/showcase/silvergeko.md b/content/showcase/silvergeko.md index 9c4c2fcb6..ab68cb98a 100644 --- a/content/showcase/silvergeko.md +++ b/content/showcase/silvergeko.md @@ -6,7 +6,7 @@ licenseLink: "" sitelink: http://silvergeko.it/ tags: - profesional -image: silvergeko.jpg +image: silvergeko.jpg title: Silvergeko --- diff --git a/content/showcase/softinio.md b/content/showcase/softinio.md index 87f0df04e..b23ef6493 100644 --- a/content/showcase/softinio.md +++ b/content/showcase/softinio.md @@ -10,6 +10,6 @@ tags: - personal - technical - blog -image: softinio-tn.png +image: softinio.png title: Salar Rahmanian --- diff --git a/content/showcase/spf13.md b/content/showcase/spf13.md index c463858fd..619f4d1aa 100644 --- a/content/showcase/spf13.md +++ b/content/showcase/spf13.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/spf13/spf13.com tags: - personal - blog -image: spf13-tn.jpg +image: spf13.jpg title: spf13.com --- diff --git a/content/showcase/steambap.md b/content/showcase/steambap.md index d722970ed..5c6fdd94c 100644 --- a/content/showcase/steambap.md +++ b/content/showcase/steambap.md @@ -8,6 +8,6 @@ sourcelink: https://github.com/steambap/weilinshi.org tags: - personal - blog -image: steambap.png +image: steambap.png title: weilinshi --- diff --git a/content/showcase/stefano.chiodino.md b/content/showcase/stefano.chiodino.md index c86b3c169..01245697b 100644 --- a/content/showcase/stefano.chiodino.md +++ b/content/showcase/stefano.chiodino.md @@ -8,7 +8,7 @@ sourcelink: https://github.com/Draga/go-web tags: - personal - blog -image: stefano.chiodino-tn.png +image: stefano.chiodino.png title: stefano.chiodino.uk --- diff --git a/content/showcase/stou.md b/content/showcase/stou.md index a50be5af5..2481aff25 100644 --- a/content/showcase/stou.md +++ b/content/showcase/stou.md @@ -9,7 +9,7 @@ sourcelink: "https://github.com/stou/stou.github.io" tags: - personal - blog -image: stou-tn.png +image: stou.png title: stou.dk --- diff --git a/content/showcase/szymonkatra.md b/content/showcase/szymonkatra.md index b64e6a2f4..a73e50b3a 100644 --- a/content/showcase/szymonkatra.md +++ b/content/showcase/szymonkatra.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/SzymonKatra/SzymonKatra.github.io/tree/master/hug tags: - personal - blog -image: szymonkatra-tn.png +image: szymonkatra.png title: szymonkatra.github.io --- diff --git a/content/showcase/techmadeplain.md b/content/showcase/techmadeplain.md index 9ae641e32..a1b2970a9 100644 --- a/content/showcase/techmadeplain.md +++ b/content/showcase/techmadeplain.md @@ -8,7 +8,7 @@ sitelink: http://techmadeplain.com/ tags: - personal - blog -image: techmadeplain-tn.jpg +image: techmadeplain.jpg title: Tech Made Plain --- diff --git a/content/showcase/tendermint.md b/content/showcase/tendermint.md index 48e37f7c3..570fc99c2 100644 --- a/content/showcase/tendermint.md +++ b/content/showcase/tendermint.md @@ -8,7 +8,7 @@ sitelink: http://tendermint.com/ sourcelink: https://github.com/tendermint/tendermint.github.io tags: - project -image: tendermint-tn.jpg +image: tendermint.jpg title: tendermint --- diff --git a/content/showcase/thecodeking.md b/content/showcase/thecodeking.md index eec7def7a..ff5066423 100644 --- a/content/showcase/thecodeking.md +++ b/content/showcase/thecodeking.md @@ -7,7 +7,7 @@ sitelink: http://thecodeking.co.uk tags: - personal - blog -image: thecodeking-tn.png +image: thecodeking.png title: thecodeking --- diff --git a/content/showcase/thehome.md b/content/showcase/thehome.md index b1103a7a8..03667cc02 100644 --- a/content/showcase/thehome.md +++ b/content/showcase/thehome.md @@ -9,7 +9,7 @@ sourcelink: "https://github.com/tomhelmer/website-source" tags: - personal - blog -image: thehome-tn.png +image: thehome.png title: thehome.dk --- diff --git a/content/showcase/tutorialonfly.md b/content/showcase/tutorialonfly.md index 542298390..33f3890ce 100644 --- a/content/showcase/tutorialonfly.md +++ b/content/showcase/tutorialonfly.md @@ -10,6 +10,6 @@ tags: - free - ebook download - fast -image: tutorialonfly-tn.jpg +image: tutorialonfly.jpg title: Tutorialonfly --- \ No newline at end of file diff --git a/content/showcase/ucsb.md b/content/showcase/ucsb.md index f7a424a93..d16af5733 100644 --- a/content/showcase/ucsb.md +++ b/content/showcase/ucsb.md @@ -8,7 +8,7 @@ sitelink: http://philosophy.ucsb.edu/ sourcelink: https://github.com/ucsbphil/philweb tags: - education -image: ucsb-tn.jpg +image: ucsb.jpg title: ucsb --- diff --git a/content/showcase/upbeat.md b/content/showcase/upbeat.md index f2bf11b06..e3ac4a649 100644 --- a/content/showcase/upbeat.md +++ b/content/showcase/upbeat.md @@ -8,6 +8,6 @@ sourcelink: tags: - personal - blog -image: upbeat.png +image: upbeat.png title: upbeat --- diff --git a/content/showcase/vamp.md b/content/showcase/vamp.md index b45608408..ae9d60b1c 100644 --- a/content/showcase/vamp.md +++ b/content/showcase/vamp.md @@ -10,7 +10,7 @@ tags: - documentation - company - api -image: vamp_landingpage-tn.png +image: vamp_landingpage.png title: Vamp.io --- diff --git a/content/showcase/viglug.org.md b/content/showcase/viglug.org.md index 5c2aa9b43..971ab69a5 100644 --- a/content/showcase/viglug.org.md +++ b/content/showcase/viglug.org.md @@ -9,7 +9,7 @@ tags: - tech - linux - user group -image: viglug-tn.png +image: viglug.png title: Viglug.org --- diff --git a/content/showcase/vurt.co.md b/content/showcase/vurt.co.md index a703e37a0..e7a0c4c02 100644 --- a/content/showcase/vurt.co.md +++ b/content/showcase/vurt.co.md @@ -9,7 +9,7 @@ sourcelink: https://github.com/gilesp/vurtcouk tags: - personal - blog -image: vurt.co-tn.jpg +image: vurt.co.jpg title: vurt.co.uk --- diff --git a/content/showcase/yslow-rules.md b/content/showcase/yslow-rules.md index 6ece7d638..938edf8ec 100644 --- a/content/showcase/yslow-rules.md +++ b/content/showcase/yslow-rules.md @@ -10,7 +10,7 @@ tags: - community - documentation - translation -image: yslow-rules-tn.png +image: yslow-rules.png title: YSlow Rules --- diff --git a/content/showcase/ysqi.md b/content/showcase/ysqi.md index 1b888b296..b86ce3202 100644 --- a/content/showcase/ysqi.md +++ b/content/showcase/ysqi.md @@ -8,6 +8,6 @@ sourcelink: https://github.com/ysqi/yushuangqi.com/ tags: - personal - blog -image: ysqi-blog.png +image: ysqi-blog.png title: yushuangqi-blog --- diff --git a/content/showcase/yulinling.net.md b/content/showcase/yulinling.net.md index ec2c7b84f..70169a80a 100644 --- a/content/showcase/yulinling.net.md +++ b/content/showcase/yulinling.net.md @@ -9,6 +9,6 @@ sourcelink: https://bitbucket.org/lynxiayel/yulinling_source_public tags: - blog - documentation -image: yulinling-tn.png +image: yulinling.png title: 语林灵 (Yulinling) --- diff --git a/content/templates/_index.md b/content/templates/_index.md index d4eb43155..914ec1814 100644 --- a/content/templates/_index.md +++ b/content/templates/_index.md @@ -9,8 +9,8 @@ weight: 01 categories: [templates] tags: [templating,functions] draft: false -slug: -aliases: +aliases: [/templates/overview/] toc: false notesforauthors: --- + diff --git a/content/templates/ace-templating.md b/content/templates/additional-templating-languages.md similarity index 62% rename from content/templates/ace-templating.md rename to content/templates/additional-templating-languages.md index 70298fd6f..dce55d15c 100644 --- a/content/templates/ace-templating.md +++ b/content/templates/additional-templating-languages.md @@ -1,20 +1,22 @@ --- -title: Ace Templating -linktitle: -description: In addition to Go templates and Amber templates, Hugo supports the powerful Ace templating from @yosssi. -godocref: https://godoc.org/github.com/yosssi/ace +title: Additional Templating Languages +linktitle: Additional Templating +description: In addition to Go templates and Amber templates, Hugo supports the powerful Ace templating from @yosssi and Amber templating from @eknkc. +godocref: date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -weight: -tags: [] -categories: [amber, templating options] +categories: [templates] +tags: [amber,ace,templating languages] +weight: 170 draft: false -aliases: [] -toc: false +aliases: [/templates/ace/,/templates/amber/] +toc: true --- -In addition to [Go templates][] and [Amber templates][], Hugo supports the powerful Ace templates. +Hugo natively supports Amber and Ace in addition to the powerful [Go templates][]. + +## Ace Templates For template documentation, follow the links from the [Ace project](https://github.com/yosssi/ace). @@ -25,11 +27,11 @@ For template documentation, follow the links from the [Ace project](https://gith * `= include partials/foo.html .` * `{{ partial "foo" . }}` -One noticeable difference between Ace and the other templating engines in Hugo is [Ace's inheritance support through base and inner templates][]. +One noticeable difference between Ace and the other templating engines in Hugo is [Ace's inheritance support through base and inner templates][aceinheritance]. In Hugo, the Ace base template will be chosen with the same rule set as for [Go base templates][]. -``` +```bash .: index.ace @@ -42,7 +44,7 @@ baseof.ace list.ace single.ace single-baseof.ace ``` {{% note %}} -Note that the `html` suffix is needed, even if the filename is suffixed `ace`. This does not work from inside a theme ([issue #763](https://github.com/spf13/hugo/issues/763)). +Note that the `html` suffix is needed even if the filename is suffixed `ace`. This does not work from inside a theme ([issue #763](https://github.com/spf13/hugo/issues/763)). {{% /note %}} Some examples for the layout files above: @@ -56,8 +58,17 @@ Some examples for the layout files above: In most cases, one `baseof.ace` in `_default` will suffice. An Ace template without a reference to a base section (e.g., `= content`) will be handled as a standalone template. {{% /note %}} -[Ace's inheritance support through base and inner templates]: https://github.com/yosssi/ace/tree/master/examples/base_inner_template -[Amber templates]: /templates/amber-templating/ +## Amber Templates + +For Amber template documentation, follow the links from the [Amber project][]. + +* Amber templates must be named with the Amber suffix; e.g., `list.amber` +* Partials in Amber or HTML can be included with the Amber template syntax: + * `import ../partials/test.html ` + * `import ../partials/test_a.amber ` + +[aceinheritance]: https://github.com/yosssi/ace/tree/master/examples/base_inner_template +[Amber Project]: https://github.com/eknkc/amber [template functions]: /functions/ [Go templates]: /templates/go-template-primer/ [Go base templates]: /templates/base-templates-and-blocks/ \ No newline at end of file diff --git a/content/templates/amber-templating.md b/content/templates/amber-templating.md deleted file mode 100644 index 1f3cc259d..000000000 --- a/content/templates/amber-templating.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: Amber Templating -linktitle: -description: In addition to Go templates and Ace templates, Hugo supports the powerful Amber templating from @eknkc. -godocref: https://godoc.org/github.com/eknkc/amber -date: 2017-02-01 -publishdate: 2017-02-01 -lastmod: 2017-02-01 -weight: -categories: [templates] -tags: [amber, templating options] -draft: false -aliases: [/templates/amber/] -toc: false ---- - -Hugo also supports the Amber templating engine in addition to [Go templates][] and [Ace templates][] templates. - -For template documentation, follow the links from the [Amber project][]. - -* Amber templates must be named with the Amber suffix; e.g., `list.amber` -* Partials in Amber or HTML can be included with the Amber template syntax: - * `import ../partials/test.html ` - * `import ../partials/test_a.amber ` - -[Ace templates]: /templates/ace-templating/ -[Amber project]: https://github.com/eknkc/amber -[Go templates]: /templates/go-template-primer/ \ No newline at end of file diff --git a/content/templates/base-templates-and-blocks.md b/content/templates/base-templates-and-blocks.md index cb5735ab6..a93a608cc 100644 --- a/content/templates/base-templates-and-blocks.md +++ b/content/templates/base-templates-and-blocks.md @@ -6,9 +6,9 @@ godocref: date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -weight: categories: [templates] tags: [blocks,base,fundamentals] +weight: 20 draft: false aliases: [/templates/blocks/] toc: true diff --git a/content/templates/content-view-templates.md b/content/templates/content-view-templates.md index 3923828a8..b57a72cf5 100644 --- a/content/templates/content-view-templates.md +++ b/content/templates/content-view-templates.md @@ -5,9 +5,9 @@ description: date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -weight: categories: [templates] tags: [views] +weight: 70 draft: false aliases: [/templates/views/] toc: false diff --git a/content/templates/custom-404-page.md b/content/templates/custom-404-page.md index 20a1fe322..999b61c23 100644 --- a/content/templates/custom-404-page.md +++ b/content/templates/custom-404-page.md @@ -5,9 +5,9 @@ description: date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -weight: categories: [templates] tags: [404, page not found] +weight: 120 draft: false aliases: [/templates/404/] toc: false diff --git a/content/templates/data-templates.md b/content/templates/data-templates.md index f225cf5de..c00f14cf0 100644 --- a/content/templates/data-templates.md +++ b/content/templates/data-templates.md @@ -5,9 +5,9 @@ description: date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -weight: categories: [templates] tags: [data,dynamic,csv,json,toml,yaml] +weight: 80 draft: false aliases: [/extras/datafiles/,/extras/datadrivencontent/,/doc/datafiles/] toc: false diff --git a/content/templates/go-template-primer.md b/content/templates/go-template-primer.md index 83894657b..8afd415d2 100644 --- a/content/templates/go-template-primer.md +++ b/content/templates/go-template-primer.md @@ -1,17 +1,16 @@ --- title: Go Template Primer -linktitle: +linktitle: Go Template Primer description: godocref: https://golang.org/pkg/html/template/ date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 -weight: -tags: [] categories: [templates] +tags: [go,fundamentals] +weight: 10 draft: false -slug: -aliases: [/templates/go-templates/] +aliases: [/templates/go-templates/,/layouts/go-templates/,/layout/go-templates/] toc: true needsreview: true --- @@ -40,9 +39,9 @@ Parameters for functions are separated using spaces. The following example calls ```golang {{ add 1 2 }} -```d +``` -**Methods and fields are accessed via dot notation** +#### Methods and Fields are Accessed via dot Notation Accessing the Page Parameter "bar" @@ -50,7 +49,7 @@ Accessing the Page Parameter "bar" {{ .Params.bar }} ``` -**Parentheses can be used to group items together** +#### Parentheses can be Used to Group Items Together ```golang {{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }} @@ -76,20 +75,24 @@ Variables can also be defined and referenced. ## Functions -Go template ships with a few functions which provide basic functionality. The Go template system also provides a mechanism for applications to extend the available functions with their own. [Hugo template functions][hugofunctions] provide some additional functionality we believe are useful for building websites. Functions are called by using their name followed by the required parameters separated by spaces. Template functions cannot be added without recompiling Hugo. +Go template ships with a few functions that provide basic functionality. The Go template system also provides a mechanism for applications to extend the set of available functions. [Hugo template functions][hugofunctions] provide additional functionality we believe us useful for building websites. Functions are called by using their name followed by the required parameters separated by spaces. Template functions cannot be added without recompiling Hugo. ### Example 1: Adding Numbers ```golang {{ add 1 2 }} +=> 3 ``` ### Example 2: Comparing Numbers ```golang {{ lt 1 2 }} +=> true (i.e., since 1 is less than 2) ``` +Note that both examples make us of Go template's [math functions][]. + {{% note "Additional Boolean Operators" %}} There are more boolean operators than those listed in the Hugo docs in the [Golang template documentation](http://golang.org/pkg/text/template/#hdr-Functions). {{% /note %}} @@ -108,7 +111,7 @@ the /layout/ directory within Hugo. ``` And, starting with Hugo v0.12, you may also use the `partial` call -for [partial templates][]: +for [partial templates][partials]: ```golang {{ partial "header.html" . }} @@ -209,7 +212,7 @@ Because of the very simple syntax of Go templates, the pipe is essential to bein A few simple examples should help convey how to use the pipe. -**Example 1:** +### Example 1: `shuffle` ```golang {{ shuffle (seq 1 5) }} @@ -221,7 +224,7 @@ is the same as {{ (seq 1 5) | shuffle }} ``` -**Example 2:** +### Example 2: `index` ```golang {{ index .Params "disqus_url" | html }} @@ -229,31 +232,35 @@ is the same as Access the page parameter called "disqus_url" and escape the HTML. -The `index` function is a built in to [Go][] built-in. [You can read more about `index` in the Godocs][]. The Godocs have the following to say about`index`: +The `index` function is built in to [Go][]. [You can read more about `index` in the Godocs][]. The Godocs have the following to say about`index`: > ...returns the result of indexing its first argument by the following arguments. Thus "index x 1 2 3" is, in Go syntax, `x[1][2][3]`. Each indexed item must be a map, slice, or array. -**Example 3:** +### Example 3: `or` with `isset` - {{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr") }} - Stuff Here - {{ end }} +```golang +{{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr") }} +Stuff Here +{{ end }} Could be rewritten as - {{ if isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" }} - Stuff Here - {{ end }} +```golang +{{ if isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" }} +Stuff Here +{{ end }} -### Internet Explorer Conditional Comments +### Example $: Internet Explorer Conditional Comments By default, Go Templates remove HTML comments from output. This has the unfortunate side effect of removing Internet Explorer conditional comments. As a workaround, use something like this: - {{ "" | safeHTML }} +```golang +{{ "" | safeHTML }} +``` -Alternatively, use the backtick (`` ` ``) to quote the IE conditional comments, avoiding the tedious task of escaping every double quotes (`"`) inside, as demonstrated in the [examples](http://golang.org/pkg/text/template/#hdr-Examples) in the Go text/template documentation, e.g.: +Alternatively, you can use the backtick (`` ` ``) to quote the IE conditional comments, avoiding the tedious task of escaping every double quotes (`"`) inside, as demonstrated in the [examples](http://golang.org/pkg/text/template/#hdr-Examples) in the Go text/template documentation: ``` {{ `` | safeHTML }} @@ -263,9 +270,9 @@ Alternatively, use the backtick (`` ` ``) to quote the IE conditional comments, The most easily overlooked concept to understand about Go templates is that `{{ . }}` always refers to the current context. In the top level of your template, this will be the data set made available to it. Inside of a iteration, however, it will have the value of the current item. When inside of a loop, the context has changed: `{{ . }}` will no longer refer to the data available to the entire page. If you need to access this from within the loop, you will likely want to do one of the following: -### Define Variable Independent of Context +### Define a Variable Independent of Context -variable instead of depending on the context. For example: +The following shows how to define a variable independent of the context. {{% input "range-through-tags-w-variable.html" %}} ```html @@ -283,12 +290,12 @@ variable instead of depending on the context. For example: {{% /input %}} {{% note %}} -Notice how once we have entered the loop, the value of `{{ . }}` has changed. We have defined a variable outside of the loop (`{{$title}}`) so we have access to it from within the loop. +Notice how once we have entered the loop (i.e. `range`), the value of `{{ . }}` has changed. We have defined a variable outside of the loop (`{{$title}}`) that we've assigned a value so that we have access to the value from within the loop as well. {{% /note %}} ### Use `$.` to Access the Global Context -from anywhere. Here is an equivalent example: +`$` has special significance in your templates. `$` is set to the starting value of `.` ("the dot") by default. This is a [documented feature of Go text/template][]. This means you have access to the global context from anywhere. Here is an equivalent example of the preceding code block where we defined `$title` and `$base` for the same desired output, but now using `$`: {{% input "range-through-tags-w-global.html" %}} ```html @@ -304,47 +311,49 @@ from anywhere. Here is an equivalent example: ``` {{% /input %}} -This is because `$`, a special variable, is set to the starting value of `.` ("the dot") by default. This is a [documented feature of Go text/template][]. - {{% warning "Don't Redefine the Dot" %}} -The built-in magic of `$` would cease to work if someone were to mischievously redefine the special character; e.g. `{{ $ := .Site }}`. *Don't do it.* You may, of course, recover from this mischief by using `{{ $ := . }}` in a global context to reset `$` to its default value. +The built-in magic of `$` would cease to work if someone were to mischievously redefine the special character; e.g. `{{ $ := .Site }}`. ***Don't do it.*** You may, of course, recover from this mischief by using `{{ $ := . }}` in a global context to reset `$` to its default value. {{% /warning %}} ## Whitespace Go 1.6 includes the ability to trim the whitespace from either side of a Go tag by including a hyphen (`-`) and space immediately beside the corresponding `{{` or `}}` delimiter. -For instance, the following Go template: +For instance, the following Go template will include the newlines and horizontal tab in its HTML output: +{{% input "with-whitespace.html" %}} ```html
{{ .Title }}
``` +{{% /input %}} -will include the newlines and horizontal tab in its HTML output: - +{{% output "with-whitespace-output.html" %}} ```html
Hello, World!
``` +{{% /output %}} -whereas using +Leveraging the `-` in the following example will remove the extra white space surrounding the `.Title` variable and remove the newline: +{{% input "without-whitespace-input.html" %}} ```html
{{- .Title -}}
``` +{{% /input %}} -in that case will output simply - +{{% output "without-whitespace-input.html" %}} ```html
Hello, World!
``` +{{% /output %}} -Go considers the following characters as whitespace: +Go considers the following characters whitespace: * space * horizontal tab @@ -353,42 +362,48 @@ Go considers the following characters as whitespace: ## Hugo Parameters -Hugo provides the option of passing values to the template language through the site configuration (for sitewide values), or through the meta data of each specific piece of content. You can define any values of any type (supported by your front matter/config format) and use them however you want to inside of your templates. +Hugo provides the option of passing values to the template language through the site configuration (i.e. for site-wide values), or through the metadata of each specific piece of content (i.e. the [front matter][]). You can define any values of any type---as long as they are supported by the front matter format specified via `metaDataFormat` in your configuration file---and use them however you want in your templates. -## Using Content (page) Parameters +## Using Content (`Page`) Parameters -In each piece of content, you can provide variables to be used by the templates. This happens in the [front matter][]. +You can provide variables to be used by templates in individual content's [front matter][]. -An example of this is used in this documentation site. Most of the pages benefit from having the table of contents provided. Sometimes the TOC just doesn't make a lot of sense. We've defined a variable in our front matter of some pages to turn off the TOC from being displayed. +An example of this is used in this documentation site and specifically on the page you're currently reading. Most of the pages benefit from having the table of contents provided, but sometimes the table of contents doesn't make a lot of sense. We've defined a variable in our front matter that will prevent a table of contents from rendering when specifically set to `false`. Here is the example front matter: ```yaml --- -title: "Permalinks" -lastmod: 2015-11-30 -date: "2013-11-18" -aliases: - - "/doc/permalinks/" -groups: ["extras"] -groups_weight: 30 -notoc: true +title: Go Template Primer +lastmod: 2017-02-21 +date: 2013-11-18 +toc: true --- ``` -Here is the corresponding code inside of the template: +Here is the corresponding code inside the `table-of-contents.html` [partial template][partials]: +{{% input "table-of-contents.html" %}} ```html -{{ if not .Params.notoc }} -
- {{ .TableOfContents }} -
-{{ end }} +{{if ne .Params.toc false}} + + +{{end}} ``` +{{% /input %}} -## Using Site (config) Parameters +We want the *default* behavior to be for pages to include a TOC unless otherwise specified. This template checks to make sure that the `toc:` field in this page's front matter does not equal (i.e. `ne`) `false`. -In your top-level configuration file (e.g., `config.yaml`), you can define site-level parameters that are available to you as variables throughout your templates. +## Using Site Configuration Parameters + +In your [site's configuration file][hugoconfig] (e.g., `config.yaml`), you can define site-level parameters that are available to you as variables throughout your templates. For instance, you might declare: @@ -403,14 +418,17 @@ params: Within a footer layout, you might then declare a `