Hugo Shortcodes Library
GitHubToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

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!

How to use

{{< read_file_contents path="/layouts/shortcodes/read_file_contents.html" >}}


{{ with .Get "path" }}
{{ os.ReadFile . }}
{{ end}}


Using {{< read_file_contents path="/Makefile" >}}.

# Makefile

	hugo --gc --minify

	hugo server -D -b localhost:1111 --port 1111