Hi,
I am trying to use pagebundles inside index.html file as follows:
{{with .Site.GetPage "/home" }}
{{ with .GetPage "index.md" }}
{{ .Content }}
{{ end }}
{{ end }}
where the home
directory is a leaf bundle present inside the content
directory. However, I am unable to display the contents of the index.md
file.
Can someone please help me ? I am unable to figure out what the problem is.
bep
June 7, 2022, 8:22am
2
Because you chose it to be.
Note that this is a little bit unortodox.
Most people keep the home page as the root, e.g:
content
βββ _index.md
βββ posts
βββ post1
β βββ index.md
βββ post2
βββ index.md
You can then get the home page
site.GetPage "/"
# Shortcut
site.Home
So the home
directory is a page ? Interesting. Why is this the case ? Btw, following your suggestion, I still canβt seem to show the contents of index.md
.
Edit: I believe there should be a /
before home
. It works now with the /
.
This makes more sense to me now. Thank you Iβll try adding some resources using
{{ with .Resources.GetMatch "img.png" }}
<img src="data:{{ .MediaType }};base64,{{ .Content | base64Encode }}">
{{ end }}
for example and see how it goes.
1 Like