sitename:Theory and Practiceog:Url:https://siongui.github.io/Locale:en_US
We want to apply the above data to the template of text/template or
html/template package to create textual/HTML output.
First use Google [2] to find Go YAML parser. I found github.com/ghodss/yaml[3] is a good choice because we can define a struct once and use it for both
JSON and YAML. Install the YAML parser by:
$goget-ugithub.com/ghodss/yaml
Then we will read the data from YAML file, parse the YAML data, and store the
result in a pre-defined struct, i.e., Unmarshal the YAML data. This is what the
following code does:
=== RUN TestServeFromYAML
sitename: Theory and Practice
open graph url: https://siongui.github.io/
open graph locale: en_US
--- PASS: TestServeFromYAML (0.00s)
PASS