{{- partial "list-icon.html" . -}}{{with .LinkTitle}}{{. | markdownify}}{{else}}{{.Title | markdownify}}{{end}}{{with .Params.sitelink }} {{end}}
-{{.Description | markdownify }}
-diff --git a/themes/hugodocs/archetypes/default.md b/archetypes/default.md similarity index 100% rename from themes/hugodocs/archetypes/default.md rename to archetypes/default.md diff --git a/themes/hugodocs/archetypes/tutorials.md b/archetypes/tutorials.md similarity index 100% rename from themes/hugodocs/archetypes/tutorials.md rename to archetypes/tutorials.md 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 efaff6fb6..756d0fff9 100644 --- a/content/contribute-to-hugo/contribute-to-the-hugo-docs.md +++ b/content/contribute-to-hugo/contribute-to-the-hugo-docs.md @@ -15,7 +15,7 @@ toc: true needsreview: true --- -Documentation is an integral part of any open source project. The Hugo docs were completely reworked in anticipation of the release of v0.19, but there is always room for improvement. +Documentation is a critical component of any open-source project. The Hugo docs were completely reworked in anticipation of the release of v0.19, but there is always room for improvement. -## Creating New Content for the Hugo Docs +## Adding a New Content Pages -**IN DEVELOPMENT** +The Hugo docs are built using Hugo and therefore make heavy use of Hugo's [archetype][] feature to easily scaffold new instances of content types. All [content sections][] in Hugo documentation have an assigned archetypes ([see source][archsource]) ### Adding a New Function @@ -41,11 +41,13 @@ Documentation is an integral part of any open source project. The Hugo docs were **IN DEVELOPMENT** -## Code Block Shortcode Examples +## Adding Code Blocks to Hugo Docs + +### Code Block Shortcodes **IN DEVELOPMENT** -### Input Code Block +### Code Block **IN DEVELOPMENT** @@ -56,7 +58,6 @@ Documentation is an integral part of any open source project. The Hugo docs were ## Blockquotes - ## Admonition Short Codes **Admonitions** are common directives in technical documentation. The most popular is that seen in [reStructuredTex Directives][sourceforge]. From the SourceForge documentation: @@ -148,6 +149,10 @@ The Hugo docs are not especially prescriptive in terms of grammar and usage. We 2. *Homepage* is one word. 3. Be sure to add a `godocref` whenever possible to a new content file's front matter. We want to promote Hugo *and* Golang by demonstrating the inseparable wedding of the two. +## Pages Needing Code Examples + +{{< needsexamples >}} + ## How Content is Ordered in the Docs **IN DEVELOPMENT** @@ -158,5 +163,7 @@ Use aliases sparingly. The following table shows a list of all the aliases used {{< allaliases >}} +[archsource]: https://github.com/spf13/hugo/tree/master/docs/archetypes +[archetype]: /content-management/archetypes/ [shortcodeparams]: content-management/shortcodes/#shortcodes-without-markdown [sourceforge]: http://docutils.sourceforge.net/docs/ref/rst/directives.html#admonitions \ No newline at end of file diff --git a/content/functions/absLangURL.md b/content/functions/absLangURL.md index 8af697f6f..395c2f3b5 100644 --- a/content/functions/absLangURL.md +++ b/content/functions/absLangURL.md @@ -16,6 +16,7 @@ relatedfuncs: [] deprecated: false draft: false aliases: [] +needsexamples: true --- ## Example diff --git a/content/functions/default.md b/content/functions/default.md index a9a7845cd..b82ec518f 100644 --- a/content/functions/default.md +++ b/content/functions/default.md @@ -17,6 +17,7 @@ relatedfuncs: [] deprecated: false draft: false aliases: [/functions/default/] +needsexamples: false --- Checks whether a given value is set and returns a default value if it is not. *Set* in this context means different things depending on date type: diff --git a/content/functions/dict.md b/content/functions/dict.md index f423611d1..0fcb5621c 100644 --- a/content/functions/dict.md +++ b/content/functions/dict.md @@ -17,5 +17,37 @@ relatedfuncs: [] deprecated: false draft: false aliases: [] +needsexamples: true --- +Creates a dictionary `(map[string, interface{})`, expects parameters added in value:object fasion. +Invalid combinations like keys that are not strings or uneven number of parameters, will result in an exception thrown. +Useful for passing maps to partials when adding to a template. + +e.g. Pass into "foo.html" a map with the keys "important, content" + +{{% code file="dict-example.html" %}} +```html +{{$important := .Site.Params.SomethingImportant }} +{{range .Site.Params.Bar}} + {{partial "foo" (dict "content" . "important" $important)}} +{{end}} +``` +{{% /code %}} + +And then in `foo.html`: + +```golang +Important {{.important}} +{{.content}} +``` + +`dict` also allows you to create a map on the fly to pass into + +{{% code file="dict-create-map.html" %}} +```golang +{{partial "foo" (dict "important" "Smiles" "content" "You should do more")}} +``` +{{% /code %}} + + diff --git a/content/functions/shuffle.md b/content/functions/shuffle.md index 1a5d3e610..3dc95467c 100644 --- a/content/functions/shuffle.md +++ b/content/functions/shuffle.md @@ -17,9 +17,27 @@ relatedfuncs: [] deprecated: false draft: false aliases: [] +needsexamples: true --- -## Example +### shuffle -## Advanced Example +`shuffle` returns a random permutation of a given array or slice: +{{% code file="shuffle-input.html" %}} +```html +
{{.Description | markdownify }}
-{{.Description | markdownify }}
+