From ceb94d1e14b55412e08d37731c4cfc48c759c21e Mon Sep 17 00:00:00 2001 From: Randy Stauner Date: Wed, 21 Feb 2018 07:22:54 -0700 Subject: [PATCH] Fix readDir function links --- content/templates/files.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/content/templates/files.md b/content/templates/files.md index 7a0f40822..b7fbf66a2 100644 --- a/content/templates/files.md +++ b/content/templates/files.md @@ -21,11 +21,11 @@ toc: true ## Traverse Local Files -With Hugo's [`readDir` and `readFile` template functions][reads], you can traverse your website's files on your server. +With Hugo's [`readDir`][readDir] and [`readFile`][readFile] template functions, you can traverse your website's files on your server. ## Use `readDir` -The [`readDir` function][reads] returns an array of [`os.FileInfo`][osfileinfo]. It takes the file's `path` as a single string argument. This path can be to any directory of your website (i.e., as found on your server's file system). +The [`readDir` function][readDir] returns an array of [`os.FileInfo`][osfileinfo]. It takes the file's `path` as a single string argument. This path can be to any directory of your website (i.e., as found on your server's file system). Whether the path is absolute or relative does not matter because---at least for `readDir`---the root of your website (typically `./public/`) in effect becomes both: @@ -56,7 +56,7 @@ The initial slash `/` in `pathURL` is important in the `directoryindex` shortcod ## Use `readFile` -The [`readfile` function][reads] reads a file from disk and converts it into a string to be manipulated by other Hugo functions or added as-is. `readFile` takes the file, including path, as an argument passed to the function. +The [`readfile` function][readFile] reads a file from disk and converts it into a string to be manipulated by other Hugo functions or added as-is. `readFile` takes the file, including path, as an argument passed to the function. To use the `readFile` function in your templates, make sure the path is relative to your *Hugo project's root directory*: @@ -107,7 +107,8 @@ And here is the result as [called directly in the Hugo docs][] and rendered for [called directly in the Hugo docs]: https://github.com/gohugoio/hugo/blob/master/docs/content/templates/files.md [dirindex]: https://github.com/gohugoio/hugo/blob/master/docs/layouts/shortcodes/directoryindex.html [osfileinfo]: https://golang.org/pkg/os/#FileInfo -[reads]: /functions/readfile/ +[readDir]: /functions/readdir/ +[readFile]: /functions/readfile/ [sc]: /content-management/shortcodes/ [sct]: /templates/shortcode-templates/ [readfilesource]: https://github.com/gohugoio/hugo/blob/master/