I’m working on a Hugo project and I need to create two different pages with the following URLs:
www.example/page/
www.example/page.html
I want these pages to have distinct content and be generated simultaneously from my Hugo site. Does anyone know the best way to achieve this? Any detailed steps or configuration examples would be greatly appreciated.
I would say on the long run, I think you won’t be lucky with interfering with Hugos Content organization but you could do with frontmatter url: parameter.
try this and check the result:
with this content file for your target /page.html:
content/_page.md (note the leading underscore in filename)
{{ define "main" }}
<ul>
{{ range site.RegularPages }}
<li><a href="{{ .RelPermalink }}">{{ .Permalink }}</a></li>
{{ end }}
</ul>
{{- end -}}
layouts/_default/single.html
{{ define "main" }}
{{ .Content }}
{{- end -}}
hugo.toml
# deploy to root
baseURL = "https://www.example.com/"
# could use "en-US" here aswell
languageCode = "en"
# Website title
title = "Hugo Forum - Topic-50815"