So I have folders A, B, C
they have respective a.md, b.md, and c.md markdown files
Now a.md and c.md have the same contents.
Now to avoid maintaining the same contents in two files, I mean if I have to make changes to content, I have to make changes in both a.md and c.md files. How can I make it such a way that I just have to change the content in only one file and it reflects changes in both the URLs. (/a and /c)
One way I see is to create a custom layout i.e. layouts/C/c.html
where I copy my single.html template and also do the following.
layouts/C/c.html
{{ with .Site.GetPage "/A/a.md" }}
// all template code goes here
// all title and content will come from a.md
{{ end }}
Basically, I will keep c.md file empty, and in its layout file, I am getting the frontmatter values from a.md file, as shown in the above code.
This works fine, but it seems it is not the best way, as we are duplicating the template here. For every change to default/single.html
template , we have to change our layouts/C/c.html
for uniformity. The change will not be often but still, I thought of asking you guys if there is a better way? Or is this the best way?
Is there some way I can just import a.md frontmatter in c.md? That would be awesome I guess.