Page Bundles and UglyURLs

Hi all!

I’m running into something I’m not sure how best to address…

I have a site with uglyurls = true that works fine.
I’m just not sure how to reference items that might be included as part of a Page Bundle.

If I have content like this:

content/
├── posts/
│   ├── 2003-08-30-fertig-gelesen-kushiel-s-dart.md
│   └── 2021-11-10-a-test/
│       ├── index.md
│       └── some-image-file.jpg

I’ll see the correct /2021/11/10/a-test.html

Getting the filename as the slug with:

frontmatter:
  date: [":filename", ":default"]

and the some-image-file.jpg will end up in a sub-directory:

2021/11/13/
├── a-test
│   └── some-image-file.jpg
└── a-test.html

My question is - how can I reference the final location of the some-image-file.jpg in the post markdown?
Is this even possible at the moment?

Since it is a page bundle, the image is available as a page resource. To reference from your markdown, you will need either a shortcode or a render hook.

Your can leverage render hooks for images and links in many ways, but in my view the primary benefit is that we can logically associate an internal link with a page and an internal image with a page resource. In both cases, we obtain the URL from .Permalink or .RelPermalink. Which means the re-written URL is aware of the following site configuration settings:

  • baseURL
  • canonifyURLs
  • uglyURLs
  • relativeURLs
  • [languages]
  • [permalinks]

This might be helpful:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.