From a479cb136b5dfa7e24d387d85cd43d23c0752685 Mon Sep 17 00:00:00 2001 From: Ryan Watters Date: Sat, 25 Mar 2017 14:19:15 -0500 Subject: [PATCH] Update all uses of readfile SC to use root path --- content/concept.md | 2 +- content/content-management/archetypes.md | 2 +- content/content-management/formats.md | 2 +- content/contribute/documentation.md | 6 +++--- content/getting-started/configuration.md | 2 +- content/readfiles/README.md | 2 +- content/templates/files.md | 16 ++++++++-------- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/content/concept.md b/content/concept.md index 371b5fb3b..fa9dc5d34 100644 --- a/content/concept.md +++ b/content/concept.md @@ -460,7 +460,7 @@ Apache License - 60 ## Current Content (Source) ```markdown -{{< readfile file="content/tree.txt" >}} +{{< readfile file="/content/tree.txt" >}} ``` ## Ideal Workflow diff --git a/content/content-management/archetypes.md b/content/content-management/archetypes.md index 6dcbb2075..119eae772 100644 --- a/content/content-management/archetypes.md +++ b/content/content-management/archetypes.md @@ -175,7 +175,7 @@ As an example of archetypes in practice, the following is the `functions` archet {{% code file="archetypes/functions.md" %}} ```yaml -{{< readfile file="archetypes/functions.md" >}} +{{< readfile file="/archetypes/functions.md" >}} ``` {{% /code %}} diff --git a/content/content-management/formats.md b/content/content-management/formats.md index 9750a8d99..956256360 100644 --- a/content/content-management/formats.md +++ b/content/content-management/formats.md @@ -25,7 +25,7 @@ Before you begin writing your content in markdown, Blackfriday has a known issue You can configure multiple aspects of Blackfriday as show in the following list. See the docs on [Configuration][config] for the full list of explicit directions you can give to Hugo when rendering your site. -{{< readfile file="content/readfiles/bfconfig.md" markdown="true" >}} +{{< readfile file="/content/readfiles/bfconfig.md" markdown="true" >}} ## Extending Markdown diff --git a/content/contribute/documentation.md b/content/contribute/documentation.md index 9493c75db..d2034c471 100644 --- a/content/contribute/documentation.md +++ b/content/contribute/documentation.md @@ -51,7 +51,7 @@ The archetype for the `functions` content type is as follows: {{% code file="archetypes/functions.md" %}} ```yaml -{{< readfile file="archetypes/functions.md">}} +{{< readfile file="/archetypes/functions.md">}} ``` {{% /code %}} @@ -103,7 +103,7 @@ The archetype for the `showcase` content type is as follows: {{% code file="archetypes/showcase.md" %}} ```yaml -{{< readfile file="archetypes/showcase.md">}} +{{< readfile file="/archetypes/showcase.md">}} ``` {{% /code %}} @@ -143,7 +143,7 @@ The archetype for the `tutorials` content type is as follows: {{% code file="archetypes/tutorials.md" %}} ```yaml -{{< readfile file="archetypes/tutorials.md">}} +{{< readfile file="/archetypes/tutorials.md">}} ``` {{% /code %}} diff --git a/content/getting-started/configuration.md b/content/getting-started/configuration.md index becbe8cc5..d88f57109 100644 --- a/content/getting-started/configuration.md +++ b/content/getting-started/configuration.md @@ -344,7 +344,7 @@ Hugo typically configures Blackfriday with sane default values that should fit m 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)). -{{< readfile file="content/readfiles/bfconfig.md" markdown="true" >}} +{{< readfile file="/content/readfiles/bfconfig.md" markdown="true" >}} {{% note %}} 1. Blackfriday flags are *case sensitive* as of Hugo v0.15. diff --git a/content/readfiles/README.md b/content/readfiles/README.md index e8831aeac..4b10f0e47 100644 --- a/content/readfiles/README.md +++ b/content/readfiles/README.md @@ -10,7 +10,7 @@ These files are called using the [`readfile` shortcode (source)](../layouts/read You can call this shortcode in the docs as follows: -{{% readfile file="path/to/file.txt" markdown="true" %}} +{{% readfile file="/path/to/file.txt" markdown="true" %}} `markdown="true"` is optional (default = `"false"`) and parses the string through the Blackfriday renderer. diff --git a/content/templates/files.md b/content/templates/files.md index 08461fb0b..08d789ff7 100644 --- a/content/templates/files.md +++ b/content/templates/files.md @@ -33,7 +33,7 @@ This shortcode creates a link to each of the files in a directory---display as t {{% code file="layouts/shortcodes/directoryindex.html" download="directoryindex.html" %}} ```html -{{< readfile file="layouts/shortcodes/directoryindex.html" >}} +{{< readfile file="/layouts/shortcodes/directoryindex.html" >}} ``` {{% /code %}} @@ -60,7 +60,7 @@ The [`readfile` function][reads] reads a file from disk and converts it into a s To use the `readFile` function in your templates, make sure the path is relative to your *Hugo project's root directory*: ```html -{{ readFile "content/templates/local-file-templates" }} +{{ readFile "/content/templates/local-file-templates" }} ``` ### `readFile` Example: Add a Project File to Content @@ -68,38 +68,38 @@ To use the `readFile` function in your templates, make sure the path is relative As `readFile` is a function, it is only available to you in your templates and not your content. However, we can create a simple [shortcode template][sct] that calls `readFile`, passes the first argument through the function, and then allows an optional second argument to send the file through the Blackfriday markdown processor. The pattern for adding this shortcode to your content will be as follows: ``` -{{}} +{{}} ``` Here is the templating for our new `readfile` shortcode: {{% code file="layouts/shortcodes/readfile.html" download="readfile.html" %}} ``` -{{< readfile file="layouts/shortcodes/readfile.html">}} +{{< readfile file="/layouts/shortcodes/readfile.html">}} ``` {{% /code %}} This `readfile` shortcode is [also part of the Hugo docs][readfilesource]. So is [`testing.txt`][testfile], which we will call in this example by passing it into our new `readfile` shortcode as follows: ``` -{{}} +{{}} ``` The output "string" for this shortcode declaration will be the following: ```markdown -{{< readfile file="content/readfiles/testing.txt" >}} +{{< readfile file="/content/readfiles/testing.txt" >}} ``` However, if we want Hugo to pass this string through Blackfriday, we should add the `markdown="true"` optional parameter: ```html -{{}} +{{}} ``` And here is the result as [called directly in the Hugo docs][] and rendered for display: -{{< readfile file="content/readfiles/testing.txt" markdown="true">}} +{{< readfile file="/content/readfiles/testing.txt" markdown="true">}} [called directly in the Hugo docs]: https://github.com/spf13/hugo/blob/master/docs/content/templates/files.md [dirindex]: https://github.com/spf13/hugo/blob/master/docs/layouts/shortcodes/directoryindex.html