Netlify not rendering my post with param 'relPermalinkOverride'

Hi Hugo Community,

I’m having trouble making Netlify deploy one of my posts correctly. After spending many hours researching and testing, I figured I could use some help from the community.

What I’m trying to do:

I’m using the ‘aafu’ Hugo theme. I want to post a Rmarkdown-rendered html file as is so that once I click on the title of the blog, it opens the html file.

What I’m having trouble with:

So far I’ve figured out a solution that works perfectly on my local host. After I click on the blog title, it directs to my html via the following url:

localhost1313/docs/bayesian.html

However, when I deploy my website on Netlify, it stops working. The link turns into the following and I got a Page Not Found message. It seems it’s still looking for the file under blog.

image

My local solution:

My local solution is based on the following post:

Specifically, I inserted the following snippet into layouts/_default/list.html, right after the end tag <\h1>

  {{ range $key, $val := (.Paginator 10).Pages }}
  {{ $href := .RelPermalink }}
  {{ with .Params.relPermalinkOverride }}
    {{ with resources.Get . }}
      {{ $href = .RelPermalink }}
    {{ else }}
      {{ $href = . }}
    {{ end }}
  {{ end }}

Then I added the following front matter to the markdown blog.

+++
title = 'Bayesian Analysis'
date = 2018-05-06
draft = false
relPermalinkOverride = '\docs\bayesian.html'
tags = ['R', "Data Analytic", "Bayesian"]
+++

Everything works fine locally. Of note, instead of the above solution, I also tried saving the html under content with front matter. However, for reasons I don’t know, the format of the html file would be messed up. Hence I ended up with the the current solution.

What I tried:

I tried adding ‘relativeURLs: true’ to my config.yaml file but it didn’t work.

Here’s my netlify.toml:

[build.environment]
DART_SASS_VERSION = "1.97.3"
GO_VERSION = "1.25.6"
HUGO_VERSION = "0.155.3"
NODE_VERSION = "24.13.0"
TZ = "Europe/Oslo"

[build]
publish = "public"
command = """\
  git config core.quotepath false && \
  hugo --gc --minify --baseURL "${URL}"
  """

Did I miss anything here? Any help or guidance would be appreciated!

Here’s the name of my repo: ‘RayinNovember/RaysWebsite2026.git’

I’m not exactly sure, but: I would try with forward slashes

relPermalinkOverride = '/docs/bayesian.html'

<tr;tr>

educated guess: the value is retrieved from front matter as
‘\docs\bayesian.html’ which results in resources.Get to search for assets\docs\bayesian.html.

If this is literally passed to the filesystem resolver on a UNIX system (netlify runner) that will not match anything

These days on windows you may use \or / (most of the times), but UNIX not.

In general use forward slashes with hugo for all pathes → hugo will take care to choose the right one for your OS.

1 Like

OMG it works! I got the backward slashes from Copy Path and totally forgot about it. Thanks for saving my day!

1 Like

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