Read File Contents
A Hugo shortcode to read in the contents of any file in your source repo. Fun fact, created because of this repo! I wanted a way to showcase the shortcodes on the page, but not worry about the displayed content and the actual shortcode getting out of sync!
# file.md
{{< read_file_contents path="/layouts/shortcodes/read_file_contents.html" >}}
{{ with .Get "path" }}
{{ os.ReadFile . }}
{{ end}}
Using {{< read_file_contents path="/Makefile" >}}
.
# Makefile
build:
hugo --gc --minify
serve:
hugo server -D -b localhost:1111 --port 1111