Hi,
I have a shortcode that takes a src attribute and uses it to spit out the markdown within it.
This works with no issues at all, apart from when I try to move into nested content folders.
My specific question is:
if content folders are nested (as in, another folder level is added), do page resources stop working after the main blog post’s “root” folder?
Some examples:
This is my folder structure:
content/components/buttons/
index.md
demo-1-1.md
In the above example, I can access the contents of demo-1-1.md with the below shortcode, no problem.
{{< demo src="demo-1.1" >}}
But, I decided to add more specificity to my folder structure, as I will be shortly introducing different types of buttons.
Now, my structure will be:
content/components/buttons/
index.md
content/components/buttons/web
index.md
demo-1-1.md
what I’m finding is that the shortcode is, for the nested folder, returning 404 for demo-1-1.md.
I cannot figure out why this is happening!
The output URL for the demo file is:
http://localhost:1313/components/buttons/web/demo-1.1/index.html
which is expected. But it doesn’t render anything except a 404.
I am unable to share the repo since it’s a private one.
But here’s some code from the shortcode, in case it’s useful.
{{ $src := .Get "src" }}
*this spits out the following: demo-1.1
{{ with $.Page.File }}
*Page.File spits out: components/buttons/web/index.md
{{ $srcPath := (printf "%s%s%s" .Dir $src ".md") }}
*srcPath spits out: components/buttons/web/demo-1.1.md
<details>
<summary>View code</summary>
<pre class="language-html"><code class="language-html">{{ with $.Site.GetPage $srcPath }}{{.RawContent}}{{end}}</code></pre>
</details>
{{ end }}
I’ve tried restarting and rebuilding Hugo but this isn’t working either.
If anyone has any ideas, I’d love to see them!