Issue with GetPage in Production: _index.md Being Added to URLs

Hi everyone,

I’m facing an issue with my Hugo site where a piece of code works perfectly in my local environment, but when I deploy it to production, it behaves differently.

The code in question is:

 $.Site.GetPage $content.url 

On my local environment, this code retrieves the correct page without any issues. However, in production, Hugo seems to be adding _index.md to the URLs, causing the page lookup to fail, and I’m unable to retrieve the desired page.

For example:

  • Local: The URL resolves correctly, and the page is found.
  • Production: The URL is somehow altered to include _index.md, and the page is not found.

Has anyone encountered this issue before? Is there a known fix or a way to ensure that _index.md is not included in the URL when calling GetPage in production?

Any help or guidance would be greatly appreciated!

Thanks!

One line of code ripped out of any context will probably not get you any useful response. No one knows what $content or $content.url might be.

Your best bet would be to post a link to your repository so that people can see the whole image.