summaryrefslogtreecommitdiffstats
path: root/docs/content/en/readfiles
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/en/readfiles')
-rw-r--r--docs/content/en/readfiles/README.md16
-rw-r--r--docs/content/en/readfiles/dateformatting.md87
-rw-r--r--docs/content/en/readfiles/index.md3
-rw-r--r--docs/content/en/readfiles/pages-vs-site-pages.md34
-rw-r--r--docs/content/en/readfiles/sectionvars.md23
-rw-r--r--docs/content/en/readfiles/testing.txt3
6 files changed, 166 insertions, 0 deletions
diff --git a/docs/content/en/readfiles/README.md b/docs/content/en/readfiles/README.md
new file mode 100644
index 000000000..4b10f0e47
--- /dev/null
+++ b/docs/content/en/readfiles/README.md
@@ -0,0 +1,16 @@
+# readdirs Directory for Reusable Content
+
+Files in this directory are:
+
+1. Used in *more than one place* within the Hugo docs
+2. Used in Examples of readdir (i.e. in local file templates)
+
+These files are called using the [`readfile` shortcode (source)](../layouts/readfile.html).
+
+You can call this shortcode in the docs as follows:
+
+
+<code>{</code><code>{</code>% readfile file="/path/to/file.txt" markdown="true" %<code>}</code><code>}</code>
+
+
+`markdown="true"` is optional (default = `"false"`) and parses the string through the Blackfriday renderer.
diff --git a/docs/content/en/readfiles/dateformatting.md b/docs/content/en/readfiles/dateformatting.md
new file mode 100644
index 000000000..42138dd8a
--- /dev/null
+++ b/docs/content/en/readfiles/dateformatting.md
@@ -0,0 +1,87 @@
+Go templates [format your dates][time] according to a single reference time:
+
+```
+Mon Jan 2 15:04:05 MST 2006
+```
+
+You can think of `MST` as `07`, thus making the reference format string a sequence of numbers. The following is [taken directly from the Go docs][gdex]:
+
+```
+Jan 2 15:04:05 2006 MST
+ 1 2 3 4 5 6 -7
+```
+
+### Hugo Date Templating Reference
+
+Each of the following examples show the reference formatting string followed by the string Hugo will output in your HTML.
+
+Note that the examples were rendered and tested in [CST][] and pull from a single example date you might have in your content's front matter:
+
+```
+date: 2017-03-03T14:15:59-06:00
+```
+
+`.Date` (i.e. called via [page variable][pagevars])
+: **Returns**: `2017-03-03 14:15:59 -0600 CST`
+
+`"Monday, January 2, 2006"`
+: **Returns**: `Friday, March 3, 2017`
+
+`"Mon Jan 2 2006"`
+: **Returns**: `Fri Mar 3 2017`
+
+`"January 2nd"`
+: **Returns**: `March 3rd`
+
+`"January 2006"`
+: **Returns**: `March 2017`
+
+`"2006-01-02"`
+: **Returns**: `2017-03-03`
+
+`"Monday"`
+: **Returns**: `Friday`
+
+`"02 Jan 06 15:04 MST"` (RFC822)
+: **Returns**: `03 Mar 17 14:15 CST`
+
+`"02 Jan 06 15:04 -0700"` (RFC822Z)
+: **Returns**: `03 Mar 17 14:15 -0600`
+
+`"Mon, 02 Jan 2006 15:04:05 MST"` (RFC1123)
+: **Returns**: `Fri, 03 Mar 2017 14:15:59 CST`
+
+`"Mon, 02 Jan 2006 15:04:05 -0700"` (RFC339)
+: **Returns**: `Fri, 03 Mar 2017 14:15:59 -0600`
+
+### Cardinal Numbers and Ordinal Abbreviations
+
+Spelled-out cardinal numbers (e.g. "one", "two", and "three") and ordinal abbreviations (e.g. "1st", "2nd", and "3rd") are not currently supported.
+
+To continue with the example above:
+
+```
+{{.Date.Format "Jan 2nd 2006"}}
+```
+
+Hugo assumes you want to append `nd` as a string to the day of the month and outputs the following:
+
+```
+Mar 3nd 2017
+```
+
+### Use `.Local` and `.UTC`
+
+In conjunction with the [`dateFormat` function][dateFormat], you can also convert your dates to `UTC` or to local timezones:
+
+`{{ dateFormat "02 Jan 06 15:04 MST" .Date.UTC }}`
+: **Returns**: `03 Mar 17 20:15 UTC`
+
+`{{ dateFormat "02 Jan 06 15:04 MST" .Date.Local }}`
+: **Returns**: `03 Mar 17 14:15 CST`
+
+[CST]: https://en.wikipedia.org/wiki/Central_Time_Zone
+[dateFormat]: /functions/dateformat/
+[gdex]: https://golang.org/pkg/time/#example_Time_Format
+[pagevars]: /variables/page/
+[time]: https://golang.org/pkg/time/ \ No newline at end of file
diff --git a/docs/content/en/readfiles/index.md b/docs/content/en/readfiles/index.md
new file mode 100644
index 000000000..3d65eaa0f
--- /dev/null
+++ b/docs/content/en/readfiles/index.md
@@ -0,0 +1,3 @@
+---
+headless: true
+--- \ No newline at end of file
diff --git a/docs/content/en/readfiles/pages-vs-site-pages.md b/docs/content/en/readfiles/pages-vs-site-pages.md
new file mode 100644
index 000000000..df5c7d26e
--- /dev/null
+++ b/docs/content/en/readfiles/pages-vs-site-pages.md
@@ -0,0 +1,34 @@
+* A _regular_ page is a "post" page or a "content" page.
+ * A _leaf bundle_ is a regular page.
+* A _list_ page can list _regular_ pages and other _list_ pages. Some
+ examples are: homepage, section pages, _taxonomy_ (`/tags/`) and
+ _term_ (`/tags/foo/`) pages.
+ * A _branch bundle_ is a _list_ page.
+
+`.Site.Pages`
+: Collection of **all** pages of the site: _regular_ pages,
+ sections, taxonomies, etc. -- Superset of everything!
+
+`.Site.RegularPages`
+: Collection of only _regular_ pages.
+
+The above `.Site. ..` page collections can be accessed from any scope in
+the templates.
+
+Below variables return a collection of pages only from the scope of
+the current _list_ page:
+
+`.Pages`
+: Collection of _regular_ pages and _only first-level_
+ section pages under the current _list_ page.
+
+`.RegularPages`
+: Collection of only _regular_ pages under the
+ current _list_ page. This **excludes** regular pages in nested sections/_list_ pages (those are subdirectories with an `_index.md` file.
+
+`.RegularPagesRecursive`
+: {{< new-in "0.68.0" >}} Collection of **all** _regular_ pages under a _list_ page. This **includes** regular pages in nested sections/_list_ pages.
+
+Note
+: From the scope of _regular_ pages, `.Pages` and
+ `.RegularPages` return an empty slice.
diff --git a/docs/content/en/readfiles/sectionvars.md b/docs/content/en/readfiles/sectionvars.md
new file mode 100644
index 000000000..45aaff1f3
--- /dev/null
+++ b/docs/content/en/readfiles/sectionvars.md
@@ -0,0 +1,23 @@
+.CurrentSection
+: The page's current section. The value can be the page itself if it is a section or the homepage.
+
+.FirstSection
+: The page's first section below root, e.g. `/docs`, `/blog` etc.
+
+.InSection $anotherPage
+: Whether the given page is in the current section.
+
+.IsAncestor $anotherPage
+: Whether the current page is an ancestor of the given page.
+
+.IsDescendant $anotherPage
+: Whether the current page is a descendant of the given page.
+
+.Parent
+: A section's parent section or a page's section.
+
+.Section
+: The [section](/content-management/sections/) this content belongs to. **Note:** For nested sections, this is the first path element in the directory, for example, `/blog/funny/mypost/ => blog`.
+
+.Sections
+: The [sections](/content-management/sections/) below this content.
diff --git a/docs/content/en/readfiles/testing.txt b/docs/content/en/readfiles/testing.txt
new file mode 100644
index 000000000..6428710e3
--- /dev/null
+++ b/docs/content/en/readfiles/testing.txt
@@ -0,0 +1,3 @@
+##### Hello World!
+
+Testing one, **two**, *three*. Don't delete this sample file used in the [templates](/templates/) section of the Hugo docs. \ No newline at end of file