[SOLVED] Configuration change for display from the file system? (no web server)

Hello

How do I change my ‘config.toml’ [1] to make sure the links in the menu work when the html files are displayed directly from the file system (no web server).
I changed

 baseURL = "."

but this is not sufficient.

Details

I have set up the example given in the quick start - Anake theme.

With the command

hugo

the content of the ‘public’ folder was created.

I opened ‘index.html’ directly from the file system.

However the links in the top menu do not work, i.e.

posts

goes to

file:///home/user/Documents/public/post/

instead of

file:///home/user/Documents/public/post/index.html

How do I change config.toml so that I get the link to the latter.

Thank you for the answer in advance

HJH

[1]

config.toml

title = "Notre-Dame de Paris"
baseURL = "."
# baseURL = "https://example.com"
languageCode = "en-us"
theme = "gohugo-theme-ananke"


MetaDataFormat = "yaml"
DefaultContentLanguage = "en"
SectionPagesMenu = "main"
Paginate = 3 # this is set low for demonstrating with dummy content. Set to a higher number
googleAnalytics = ""
enableRobotsTXT = true

[sitemap]
  changefreq = "monthly"
  priority = 0.5
  filename = "sitemap.xml"

[params]
  favicon = ""
  description = "The last theme you'll ever need. Maybe."
  facebook = ""
  twitter = "https://twitter.com/GoHugoIO"
  instagram = ""
  youtube = ""
  github = ""
  linkedin = ""
  # choose a background color from any on this page: http://tachyons.io/docs/themes/skins/ and preface it with "bg-"
  background_color_class = "bg-black"
  featured_image = "/images/gohugo-default-sample-hero-image.jpg"
  recent_posts_number = 2
  themesDir = "themes"

Hugo is not meant to output local files the way you want.

With that said maybe if you set uglyURLs to true in your config you’ll get what you ask.

1 Like

@alexandros

Thanks for the answer! For the Ananke theme this works fine!

I am suprised to learn that Hugo is not meant to also produce static files to be consumed locally without a web server.

To produce local documentation or a help file system seems to be quite a common use case.

So adding

 uglyURLs = "true"

to

 config.toml

fixed the issue.

For other themes I am also experimenting with

 relativeURLs = "true"

as suggested here