Add default social image for sharing

This commit is contained in:
Ryan Watters
2017-03-07 01:47:06 -06:00
parent 49a83a411d
commit e45a9713f2
24 changed files with 199 additions and 110 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ watch = true
## Date the Site is Published, use YYYY-MM-DD
sitepublishdate = ""
## Twitter handle without the "@"
twitterhandle = ""
twitterhandle = "GoHugoIO"
## Facebook URL
facebook = ""
## Default Image for Social Sharing. This image should live at static/images/
+53 -28
View File
@@ -18,7 +18,7 @@ wip: true
In Hugo, your content should be organized in a manner that reflects the rendered website.
While Hugo supports content nested at any level, the top levels (i.e. `content/<directories>*`) are special in Hugo and considered the content [sections][section]. Without any additional configuration, the following will just work:
While Hugo supports content nested at any level, the top levels (i.e. `content/<DIRECTORIES>`) are special in Hugo and are considered the content [sections][]. Without any additional configuration, the following will just work:
```
.
@@ -37,13 +37,13 @@ While Hugo supports content nested at any level, the top levels (i.e. `content/<
## Path Breakdown in Hugo
The following demonstrates the relationships between your content organization and the output URL structure for your Hugo website at render. These examples assume you are using pretty URLs, which is the default behavior for Hugo. The examples also assume a key-value of `baseurl = "http://yoursite.com"` in your site's configuration file.
The following demonstrates the relationships between your content organization and the output URL structure for your Hugo website at render. These examples assume you are using pretty URLs, which is the default behavior for Hugo. The examples also assume a key-value of `baseurl = "http://yoursite.com"` in your [site's configuration file][config].
### Section Index Page
`_index.md` has a special role in Hugo. It allows you to add front matter and content to your [section list template][sectionlists] as of v0.18.
`_index.md` has a special role in Hugo. It allows you to add front matter and content to your [list templates][lists] as of v0.18. These templates include those for [section templates][], [taxonomy templates][], [taxonomy terms templates][], and your [homepage template][].
You can keep one `_index.md` in each of your content sections. The following shows typical placement of an `_index.md` that would contain content or front matter for a `posts` section list page on a Hugo website:
You can keep one `_index.md` in each of your content sections. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website:
```bash
@@ -69,7 +69,7 @@ At build, this will output to the following destination with the associated valu
http://yoursite.com/posts/index.html
```
### Section Single Page
### Section Single Pages
Single content files in each of your sections are going to be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`:
@@ -112,71 +112,90 @@ To continue the example, the following demonstrates destination paths for a file
⊢----------------------^-----------------------⊣
http://yoursite.com/events/chicago/lollapalooza/
```
##
## Path Properties Explained
#### `section`
Default content type is determined by a piece of content's section. `section` is determined by the location within the project's `content` directory. `section` *cannot* be specified or overridden in front matter.
A default content type is determined by a piece of content's section. `section` is determined by the location within the project's `content` directory. `section` *cannot* be specified or overridden in front matter.
#### `slug`
A content's `slug` is either `name.extension` or `name/`. The value for `slug` is determined by
* the name of the content file (e.g., `content-name.md`)
* the name of the content file (e.g., `lollapalooza.md`) OR
* front matter overrides
#### `path`
A content's `path` is determined by the section's path to the file. The file `path`
* is based on the path to the content's location
* is based on the path to the content's location AND
* does not include the slug
#### `url`
The `url` is the relative URL for the piece of content. The `url`
* is defined in front matter
* overrides all the above
* is based on the content's location within the directory structure OR
* is defined in front matter and *overrides all the above*
## Destinations for Content Source
## Modifying Destinations for Content Source in Front Matter
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. As displayed above, the organization of the source content will be mirrored in the destination.
Notice that the first level `about/` page URL was created using a directory named "about" with a single `_index.md` file inside..
Notice that the first level `about/` page URL was created using a directory named "about" with a single `_index.md` file inside.
There are times where you may need more control over your content. In these cases, there are a variety of things that can be specified in the front matter to determine the destination of a specific piece of content.
There are times where you may need more control over your content. In these cases, there are fields that can be specified in the front matter to determine the destination of a specific piece of content.
The following items are defined in order; latter items in the list will override earlier settings.
The following items are defined in this order for a specific reason: latter items in the list will override earlier items, and not all of these items can be defined in front matter:
### `filename`
This isn't in the front matter, but is the actual name of the file minus the extension. This will be the name of the file in the destination.
This isn't in the front matter, but is the actual name of the file minus the extension. This will be the name of the file in the destination (e.g., `content/posts/my-post.md` becomes `yoursite.com/posts/my-post/`).
### `slug`
Defined in the front matter, the `slug` can take the place of the filename for the destination.
When defined in the front matter, the `slug` can take the place of the filename for the destination.
### `filepath`
{{% code file="content/posts/old-post.md" %}}
```yaml
---
title: New Post
slug: "new-post"
---
```
{{% /code %}}
The actual path to the file on disk. Destination will create the destination with the same path. Includes [section](/content/sections/).
This will render to the following destination:
```
yoursite.com/posts/new-post/
```
### `section`
`section` is determined by its location on disk and *cannot* be specified in the front matter. See [section](/content/sections/).
`section` is determined by a content's location on disk and *cannot* be specified in the front matter. See [sections][] for more information.
### `type`
`type` is also determined by its location on disk but, unlike `section`, it *can* be specified in the front matter. See [type](/content/types/).
A content's `type` is also determined by its location on disk but, unlike `section`, it *can* be specified in the front matter. See [types][].
{{% code file="content/posts/my-post.md" %}}
```yaml
---
title: My Post
type: blog
---
```
{{% /code %}}
### `path`
`path` can be provided in the front matter. This will replace the actual path to the file on disk. Destination will create the destination with the same path. Includes [section](/content/sections/).
`path` can be provided in the front matter. This will replace the actual path to the file on disk. Destination will create the destination with the same path, including the section.
### `url`
A complete URL can be provided. This will override all the above as it pertains to the end destination. This must be the path from the baseURL (starting with a "/"). When a `url` is provided, it will be used exactly. Using `url` will ignore the `--uglyURLs` setting.
A complete URL can be provided. This will override all the above as it pertains to the end destination. This must be the path from the baseURL (starting with a `/``). When `url` is provided in the front matter, it will be used exactly. Using `url` will ignore the `--uglyURLs` setting.
## \_index.md and "Everything is a Page"
@@ -290,10 +309,16 @@ An `_index.md` file has also been added in the top level 'content' directory.
Hugo themes are designed to use the 'content' directory as the root of the website, so adding an `_index.md` file here (like has been done in the example above) is how you would add front matter and content to the homepage.
[front matter]: /content-management/front-matter/
[homepage]: /templates/homepage/
[section]: /content-management/section/
[config]: /getting-started/configuration/
[formats]: /content-management/formats/
[sectionlists]: /templates/section-templates/
[front matter]: /content-management/front-matter/
[homepage template]: /templates/homepage/
[homepage]: /templates/homepage/
[lists]: /templates/lists/
[section templates]: /templates/section-templates/
[sections]: /content-management/sections/
[singles]: /templates/single-page-templates/
[taxonomy templates]: /templates/taxonomy-templates/
[taxonomy terms templates]: /templates/taxonomy-templates/
[types]: /content-management/types/
[urls]: /content-management/urls/
+57 -2
View File
@@ -13,16 +13,71 @@ workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
aliases: [/functions/index/]
needsexample: true
---
`index` looks up the index(es) or key(s) of the data structure passed into it.
From the godocs:
From the Godocs:
> 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.
In Go templates, you can't access array, slice, or map elements directly the same way you would in Go. For example, `$.Site.Data.authors[.Params.authorkey]` isn't supported syntax.
Instead, you have to use `index`, a function that handles the lookup for you.
## Example: Load Data from a Path Based on Front Matter Params
Assume you want to add a `location = ""` field to your front matter for every article written in `content/vacations/`. You want to use this field to populate information about the location at the bottom of the article in your `single.html` template. You also have a directory in `data/locations/` that looks like the following:
```
.
└── data
└── locations
├── abilene.toml
├── chicago.toml
├── oslo.toml
└── provo.toml
```
Here is an example of the data inside `data/locations/oslo.toml`:
```toml
website = "https://www.oslo.kommune.no"
pop_city = 658390
pop_metro = 1717900
```
The example we will use will be an article on Oslo, which front matter should set to exactly the same name as the corresponding file name in `data/locations/`:
```toml
title = "My Norwegian Vacation"
location = "oslo"
```
The content of `oslo.toml` can be accessed from your template using the following node path: `.Site.Data.locations.oslo`. However, the specific file you need is going to change according to the front matter.
This is where the `index` function is needed. `index` takes 2 parameters in this use case:
1. The node path
2. A string corresponding to the desired data; e.g.&mdash;
```
{{ index .Site.Data.locations “oslo” }}
```
The variable for `.Params.location` is a string and can therefore replace `oslo` in the example above:
```golang
{{ index .Site.Data.authors .Params.author }}
=> map[website:https://www.oslo.kommune.no pop_city:658390 pop_metro:1717900]
```
Now the call will return the specific file according to the location specified in the content's front matter, but you will likely want to write specific properties to the template. You can do this by continuing down the node path via dot notation (`.`):
```golang
{{ (index .Site.Data.locations .Params.location).pop_city }}
=> 658390
```
+1 -1
View File
@@ -16,7 +16,7 @@ deprecated: false
aliases: []
---
Given two arrays (or slices), `intersect` returns the common elements. The elements supported are strings, integers and floats (only float64).
Given two arrays (or slices), `intersect` returns the common elements. The elements supported are strings, integers, and floats (only float64).
A useful example of `intersect` functionality is a "related posts" block. `isset` allows us to create a list of links to other posts that have tags that intersect with the tags in the current post.
+1 -1
View File
@@ -22,6 +22,6 @@ aliases: []
{{ dict "title" .Title "content" .Plain | jsonify }}
```
See also the [`.PlainWords`, `.Plain`, and `.RawContent` page variables][pagevars].
See also the `.PlainWords`, `.Plain`, and `.RawContent` [page variables][pagevars].
[pagevars]: /variables/page-variables/
+1 -1
View File
@@ -18,7 +18,7 @@ draft: false
aliases: []
---
`last` slices an array to only the last *N*th elements.
`last` slices an array to only the last <em>N</em>th elements.
```
{{ range last 10 .Data.Pages }}
+2
View File
@@ -20,3 +20,5 @@ aliases: []
`{{ "cats" | singularize }}` → "cat"
See also the `.Data.Singular` [taxonomy variable](/variables/taxonomy-variables/) for singularizing taxonomy names.
+10 -10
View File
@@ -22,20 +22,20 @@ The latest release can be found at [Hugo Releases][releases].
Hugo currently provides pre-built binaries for the following:
* <i class="fa fa-apple"></i>&nbsp;OS&nbsp;X (Darwin) for x64, i386, and ARM architectures
* <i class="fa fa-windows"></i>&nbsp;Windows,
* <i class="fa fa-linux"></i>&nbsp;Linux,
* <i class="icon-freebsd"></i>&nbsp;FreeBSD
* <i class="fa fa-apple"></i> OS X (Darwin) for x64, i386, and ARM architectures
* <i class="fa fa-windows"></i> Windows
* <i class="fa fa-linux"></i> Linux
* <i class="icon-freebsd"></i> FreeBSD
Hugo may also be compiled from source wherever the Go compiler tool chain can run; e.g., for other operating systems, including DragonFly BSD, OpenBSD, Plan&nbsp;9 and Solaris. See <http://golang.org/doc/install/source> for the full set of supported combinations of target operating systems and compilation architectures.
### Quick Install: Binary (Cross-platform)
### Binary (Cross-platform)
Download the appropriate version for your platform from [Hugo Releases][releases]. Once downloaded, the binary can be run from anywhere. You don't need to install it into a global location. This works well for shared hosts and other systems where you don't have a privileged account.
Ideally, you should install it somewhere in your `PATH` for easy use. `/usr/local/bin` is the most probable location.
### Quick Install: OS X (Homebrew)
### OS X (Homebrew)
If you are on OS X and using [Homebrew][brew], you can install Hugo with the following one-liner:
@@ -47,7 +47,7 @@ brew update && brew install hugo
For more detailed explanations, read the installation guides that follow for [Windows](#installing-hugo-on-windows) and [Mac OS X](#installing-hugo-on-mac-osx).
### Quick Install: Source
### Source
#### Prerequisite tools for downloading and building source code
@@ -72,7 +72,7 @@ You may run `go get` with the `-u` option to update Hugo's dependencies:
go get -u -v github.com/spf13/hugo
```
## <i class="fa fa-apple"></i> Installing Hugo on OS X
## <i class="fa fa-apple"></i> OS X
### Assumptions
@@ -293,7 +293,7 @@ go build -o hugo main.go
Then place the `hugo` executable somewhere in your `$PATH`. You're now ready to start using Hugo.
## <i class="fa fa-windows"></i> Installing Hugo on Windows
## <i class="fa fa-windows"></i> Windows
The following aims to be a complete guide to installing Hugo on your Windows PC.
@@ -408,7 +408,7 @@ C:\Hugo\Sites\example.com&gt;dir
{{< youtube c8fJIRNChmU >}}
## <i class="fa fa-linux"></i> Installing Hugo on Linux
## <i class="fa fa-linux"></i> Linux
### Installing From Snap
+1
View File
@@ -12,6 +12,7 @@ weight: 10
draft: false
aliases: [/overview/quickstart/]
toc: true
wip: true
---
{{% note %}}
+1 -2
View File
@@ -37,7 +37,6 @@ As an example, let's assume your site is using the theme when rendering the sect
7. `/layouts/_default/baseof.html`
8. `/themes/<THEME>/layouts/_default/baseof.html`
## Defining the Base Template
The following defines a simple base template at `_default/baseof.html`). As a default template, it is the shell from which all our pages will start unless a more specific `*baseof.html` is defined.
@@ -89,7 +88,7 @@ From the above base template, you can define a [default list template][hugolists
When using the `define` keyword, you do *not* need to use Go templates context reference (i.e., 'The Dot"). (Read more on ["The Dot" in the Go Template Primer](/templates/go-templates/).)
{{% /note %}}
This replaces the contents of our (basically empty) "main" block with something useful for the list template. In this case, we didn't define a `"title"`` block, so the contents from our base template remain unchanged in lists.
This replaces the contents of our (basically empty) "main" block with something useful for the list template. In this case, we didn't define a `"title"` block, so the contents from our base template remain unchanged in lists.
{{% warning %}}
Code that you put outside the block definitions *can* break your layout. This even includes HTML comments. For example:
+1 -1
View File
@@ -10,7 +10,7 @@ tags: [internal, analytics,]
weight: 168
draft: false
aliases: []
toc: false
toc: true
wip: true
---
<!-- reference: https://discuss.gohugo.io/t/lookup-order-for-partials/5705/6 -->
+9 -5
View File
@@ -47,9 +47,11 @@ Since section lists and taxonomy lists (N.B., *not* [taxonomy terms lists][taxte
A Taxonomys RSS will be rendered at /`PLURAL`/`TERM`/index.xml (e.g.&nbsp;http://spf13.com/topics/golang/index.xml)
*Hugo ships with its own [RSS 2.0][] template. In most cases this will
{{% note %}}
Hugo ships with its own [RSS 2.0][] template. In most cases this will
be sufficient, and an RSS template will not need to be provided by the
user.*
user.
{{% /note %}}
Hugo provides the ability for you to define any RSS type you wish, and
can have different RSS files for each section and taxonomy.
@@ -59,10 +61,10 @@ can have different RSS files for each section and taxonomy.
* /themes/`THEME`/layouts/taxonomy/`SINGULAR`.rss.xml
* /themes/`THEME`/layouts/\_default/rss.xml
## Variables
## List Page Variables
A list page is a `Page` and have all the [page variables](/templates/variables/)
and [site variables](/templates/variables/) available to use in the templates.
A list page is a `Page` and has all the [page variables][pagevars]
and [site variables][sitevars] available to use in the templates.
Taxonomy pages will additionally have:
@@ -80,10 +82,12 @@ If `where` or `first` receives invalid input or a field name that doesnt exis
[homepage]: /templates/homepage/
[limitkeyword]: https://www.techonthenet.com/sql/select_limit.php
[mentalmodel]: http://webstyleguide.com/wsg3/3-information-architecture/3-site-structure.html
[pagevars]: /variables/pagevars/
[partials]: /templates/partials/
[RSS 2.0]: http://cyber.law.harvard.edu/rss/rss.html "RSS 2.0 Specification"
[rss]: /templates/rss-templates/
[sections]: /content-management/sections/
[sectiontemps]: /templates/section-templates
[sitevars]: /variables/site-variables/
[taxlists]: /templates/taxonomy-templates/#taxonomy-list-templates/
[taxterms]: /templates/taxonomy-templates/#taxonomy-terms-templates/
+28 -29
View File
@@ -18,27 +18,22 @@ wip: true
Like all other templates, you can use a single RSS template to generate all of your RSS feeds, or you can create a specific template for each individual feed.
`/layouts/section/<section>.rss.xml`
`/layouts/\_default/rss.xml`
`/themes/<theme>/layouts/section/<section>.rss.xml`
`/themes/<theme>/layouts/\_default/rss.xml`
1. `/layouts/section/<section>.rss.xml`
2. `/layouts/\_default/rss.xml`
3. `/themes/<theme>/layouts/section/<section>.rss.xml`
4. `/themes/<theme>/layouts/\_default/rss.xml`
{{% note "Hugo Ships with an RSS Template" %}}
Unlike other Hugo templates, Hugo ships with its own [RSS 2.0 template][embedded]. In most cases this will be sufficient, and an RSS template will not need to be provided by the user. But you can provide an rss template if you like, as you can see in the next section.
Unlike other Hugo templates, Hugo ships with its own [RSS 2.0 template](#the-embedded-rss-xml). The embedded template will be sufficient in most cases, and an RSS template will not need to be provided by the user. But you can provide an RSS template, as you can see in the next section.
{{% /note %}}
RSS pages are of the type `Page` and have all the [page variables](/layout/variables/) available to use in the templates.
### Section RSS
A [sections][section] RSS will be rendered at /`SECTION`/index.xml (e.g., http://spf13.com/project/index.xml)
A [sections][section] RSS will be rendered at `/<SECTION>/index.xml` (e.g., http://spf13.com/project/index.xml).
*Hugo ships with its own [RSS 2.0][] template. In most cases this will
be sufficient, and an RSS template will not need to be provided by the
user.*
Hugo provides the ability for you to define any RSS type you wish, and
can have different RSS files for each section and taxonomy.
Hugo provides the ability for you to define any RSS type you wish and can have different RSS files for each section and taxonomy.
## Which Template will be Rendered?
@@ -48,29 +43,29 @@ Hugo will use the following prioritized list. If a file isnt present, then th
### Main RSS
* /layouts/rss.xml
* /layouts/\_default/rss.xml
* [Embedded rss.xml][embedded]
1. `/layouts/rss.xml`
2. `/layouts/\_default/rss.xml`
3. [Embedded rss.xml][embedded]
### Section RSS
* /layouts/section/`SECTION`.rss.xml
* /layouts/\_default/rss.xml
* /themes/<THEME>/layouts/section/<section>.rss.xml
* /themes/`THEME`/layouts/\_default/rss.xml
* [Embedded rss.xml][embedded]
1. `/layouts/section/<SECTION>.rss.xml`
2. `/layouts/\_default/rss.xml`
3. `/themes/<THEME>/layouts/section/<SECTION>.rss.xml`
4. `/themes/<THEME>/layouts/\_default/rss.xml`
5. [Embedded rss.xml][embedded]
### Taxonomy RSS
* /layouts/taxonomy/`SINGULAR`.rss.xml
* /layouts/\_default/rss.xml
* /themes/`THEME`/layouts/taxonomy/`SINGULAR`.rss.xml
* /themes/`THEME`/layouts/\_default/rss.xml
* [Embedded rss.xml][embedded]
1. `/layouts/taxonomy/<SINGULAR>.rss.xml`
2. `/layouts/\_default/rss.xml`
3. `/themes/<THEME>/layouts/taxonomy/<SINGULAR>.rss.xml`
4. `/themes/<THEME>/layouts/\_default/rss.xml`
5. [Embedded rss.xml][embedded]
## Configuring RSS
If the following values are specified in the sites config file (`config.toml`), then they will be included in the RSS output. Example values are provided.
The following values will be included in the RSS output if specified in your sites [`config` file][config]. Example values are provided.
```toml
languageCode = "en-us"
@@ -82,6 +77,7 @@ copyright = "This work is licensed under a Creative Commons Attribution-ShareAli
## The Embedded rss.xml
This is the default RSS template that ships with Hugo. It adheres to the [RSS 2.0 Specification][RSS 2.0].
```xml
@@ -129,16 +125,19 @@ In your `header.html` template, you can specify your RSS feed in your `<head></h
{{ end }}
```
... with the autodiscovery link specified by the line with `rel="alternate"`.
...with the autodiscovery link specified by the line with `rel="alternate"`.
The `.RSSLink` will render the appropriate RSS feed URL for the section, whether it's everything, posts in a section, or a taxonomy.
**N.b.**, if you reference your RSS link, be sure to specify the mime type with `type="application/rss+xml"`.
{{% note %}}
If you reference your RSS link, be sure to specify the MIME type with `type="application/rss+xml"`.
{{% /note %}}
```html
<a href="{{ .URL }}" type="application/rss+xml" target="_blank">{{ .SomeText }}</a>
```
[embedded]:
[config]: /getting-started/configuration/
[embedded]: #the-embedded-rss-xml
[RSS 2.0]: http://cyber.law.harvard.edu/rss/rss.html "RSS 2.0 Specification"
[section]: /content-management/sections/
+18 -15
View File
@@ -17,7 +17,7 @@ wip: true
Templates used for section pages are *lists* and therefore have all the variables and methods available to [list pages][lists].
{{% note "Section Pages Pull Content from `_index.md`" %}}
To effectively leverage section page templates, you should first understand Hugo's [content organization](/content-management/organization/) and, specifically, the purpose of `_index.md` for adding content and front matter to section and other list pages.
To effectively leverage section page templates, you should first understand Hugo's [content organization][contentorg] and, specifically, the purpose of `_index.md` for adding content and front matter to section and other list pages.
{{% /note %}}
## Section Template Lookup Order
@@ -33,26 +33,26 @@ The [lookup order][lookup] for section pages is as follows:
5. `/themes/<THEME>/layouts/_default/section.html`
6. `/themes/<THEME>/layouts/_default/list.html`
## `.Site.GetPage`
## `.Site.GetPage` with Sections
Every `Page` in Hugo has a `.Kind` attribute. `Kind` can easily be combined with the [`where` function](/functions/where/) in your templates to create kind-specific lists of content. This method is ideal for creating lists, but there are times where you may want to fetch just the index page of a single section via the section's path.
Every `Page` in Hugo has a `.Kind` attribute. `Kind` can easily be combined with the [`where` function][where] in your templates to create kind-specific lists of content. This method is ideal for creating lists, but there are times where you may want to fetch just the index page of a single section via the section's path.
The [`.GetPage` function](/function/getpage/) looks up an index page of a given `Kind` and `path`.
The [`.GetPage` function][getpage] looks up an index page of a given `Kind` and `path`.
{{% note %}}
`.GetPage` is only supported in section page templates but *may* be supported in [single page templates][singlepages] in the future.
`.GetPage` is only supported in section page templates but *may* be supported in [single page templates](/templates/single-page-templates/) in the future.
{{% /note %}}
You can call `.Site.GetPage` with two arguments: `kind` and `kind value`.
The valid values for 'kind' are as follows:
These are the valid values for 'kind':
1. `home`
2. `section`
3. `taxonomy`
4. `taxonomyTerm`
### Example `.Site.GetPage` Example
### Example: Using `.Site.GetPage`
The `.Site.GetPage` example that follows assumes the following project directory structure:
@@ -71,31 +71,34 @@ The `.Site.GetPage` example that follows assumes the following project directory
`.Site.GetPage` will return `nil` if no `_index.md` page is found. Therefore, if `content/blog/_index.md` does not exist, the template will output the section name:
{{% code file="grab-blog-section-title.html" %}}
```html
<h1>{{ with .Site.GetPage "section" "blog" }}{{ .Title }}{{ end }}</h1>
```
{{% /code %}}
Since `blog` has a section content page (i.e., `_index.md`) with front matter to pull from, the above code will return the following result:
Since `blog` has a section index page with front matter at `content/blog/_index.md`, the above code will return the following result:
```html
<h1>My Hugo Blog</h1>
```
If we try the same code with the `events` section, however:
If we try the same code with the `events` section, however, Hugo will default to the section title because there is no `content/events/_index.md` from which to pull content and front matter:
{{% code file="grab-events-section-title.html" %}}
```html
<h1>{{ with .Site.GetPage "section" "events" }}{{ .Title }}{{ end }}</h1>
```
{{% /code %}}
We get the following output in our HTML at render time because `events` does *not* have an `_index.md` from which to pull your "title:" field specified in the front matter:
Which then returns
```html
<h1>Events</h1>
```
## Nested Sections
**Content forthcoming**
[contentorg]: /content-management/organization/
[getpage]: /functions/getpage/
[lists]: /templates/lists/
[lookup]: /templates/lookup-order/
[lookup]: /templates/lookup-order/
[where]: /functions/where/
+1 -1
View File
@@ -1,7 +1,7 @@
---
title: Search for your Hugo Website
linktitle: Search
description: Search is not a built-in feature of Hugo, but you have plenty of options for adding search to your Hugo-generated website. See some of the open-source and commercial search options for your newly created website.
description: See some of the open-source and commercial search options for your newly created Hugo website.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-26
+4 -4
View File
@@ -14,7 +14,7 @@ toc: true
wip: true
---
### Taxonomy Terms Page Variables
## Taxonomy Terms Page Variables
[Taxonomy terms pages][taxonomytemplates] are of the type `Page` and have the following additional variables. For example, the following fields would be available in `layouts/_defaults/terms.html`, depending on how you organize your [taxonomy templates][taxonomytemplates]:
@@ -41,13 +41,13 @@ Note that `.Data.Terms.Alphabetical` and `.Data.Terms.ByCount` can also be rever
* `.Data.Terms.Alphabetical.Reverse`
* `.Data.Terms.ByCount.Reverse`
### Using `.Site.Taxonomies` Outside of Taxonomy Templates
## Using `.Site.Taxonomies` Outside of Taxonomy Templates
The `.Site.Taxonomies` variable holds all the taxonomies defined site-wide. `.Site.Taxonomies` is a map of the taxonomy name to a list of its values (e.g., `"tags" -> ["tag1", "tag2", "tag3"]``). Each value, though, is not a string but rather a *Taxonomy variable*.
### The Taxonomy Variable
## The `.Taxonomy` Variable
The Taxonomy variable, available, for example, as `.Site.Taxonomies.tags`, contains the list of tags (values) and, for each of tag, their corresponding content pages.
The `.Taxonomy` variable, available, for example, as `.Site.Taxonomies.tags`, contains the list of tags (values) and, for each tag, their corresponding content pages.
### Example Usage of `.Site.Taxonomies`
Binary file not shown.
@@ -11,7 +11,7 @@
<meta property="og:title" content="{{ .Title }}">
<meta property="og:image" content="/images/{{ .Site.Params.defaultsocialimage }}">
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="800" />
<meta property="og:image:height" content="533" />
<meta property="og:image:width" content="1500" />
<meta property="og:image:height" content="800" />
<meta property="og:description" content="{{ .Description }}"/>
<meta property="og:site_name" content="{{ $.Site.Title }}">
+3 -3
View File
@@ -1,6 +1,6 @@
<!-- Twitter Cards summary card with large image https://dev.twitter.com/cards/types/summary-large-image-->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:site" content="@{{.Site.Params.TwitterHandle}}">
<meta property="twitter:title" content="{{.Title | default .Site.Title }}">
<meta property="twitter:image" content="/assets/images/{{.Params.image | default .Site.Params.defaultsocialimage }}">
<meta property="twitter:description" content="{{ if .IsHome }}{{ .Site.Params.sitedescription }}{{ else if .IsPage }}{{ .Description }}{{ else if .IsNode }}{{ index .Site.Data.sectiondescriptions .Title }}{{ end }}">
<meta property="twitter:title" content="{{if not .IsHome }}{{.Title }} |{{end}} {{.Site.Title }}">
<meta property="twitter:image" content="/images/{{ .Site.Params.defaultsocialimage }}">
<meta property="twitter:description" content="{{ .Description }}">
+1
View File
@@ -3,6 +3,7 @@
{{- partial "head/noindex.html" . -}}
{{- partial "head/metadata-refreshredirect.html" . -}}
{{- partial "head/metadata-standard.html" . -}}
{{- partial "head/metadata-twitter.html" . -}}
{{- partial "head/metadata-opengraph.html" . -}}
{{- partial "head/metadata-favicons.html" . -}}
{{- partial "head/metadata-prefetch.html" . -}}
+2 -2
View File
@@ -40,7 +40,7 @@ h1.page-title {
&.commands,
&.functions {
font-family: $code-font-family;
font-weight:300;
font-weight: 400;
}
}
@@ -84,7 +84,7 @@ h5 {
.functions,
.commands {
font-family: $code-font-family;
font-weight: $base-font-weight;
font-weight: 500;
color: inherit;
}
+1 -1
View File
@@ -48,7 +48,7 @@ table {
min-width: 100%;
background-color: $body-bg-color;
&:nth-child(even) {
background-color: lighten($hugo-gray-light, 10%);
background-color: $hugo-gray-ultra-light;
}
&:last-child {
border-bottom: 2px solid $hugo-gray;
+1 -1
View File
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB