Problem with custom output format

Hi there,

I have built my first site with Hugo and have been getting along pretty well so far. Unfortunately I have now encountered a problem which I can’t solve on my own: I need .aspx as the output format since I need to host the site on Sharepoint Online. I have read through the documentation and the forums here and included the required parameters in my config.toml. Unfortunately I can’t provide you with the full source as there is quite a lot of sensitive information in there but I will provide you with the config.toml below (only the links have been removed for the reason above).

Hope someone can help me. Thanks a lot!

baseURL = "private-url"
languageCode = "de-de"
title = "private title"
theme = "hugo-theme-learn"
defaultContentLanguage = "de"
uglyurls = true
disableKinds = ["taxonomyTerm", "taxonomy"]

[params]
 author = "private author"
 description = "Guidelines zum Einsatz von Logo, Farben, Schriften und Co."
 showVisitedLinks = false
 disableSearch = false
 disableLanguageSwitchingButton = true
 themeVariant = "elab"
 disableShortcutsTitle = false
 disableInlineCopyToClipBoard = true
 disableAssetsBusting = true
 subtitle = ""


[mediaTypes]
[mediaTypes."text/html"]
suffix = "aspx"

[outputFormats]
[outputFormats.HTML]
mediaType = "text/html"

[outputs]
home = [ "HTML", "RSS", "JSON"]

[[menu.shortcuts]] 
name = "<i class='fa fa-server'></i> Sharepoint"
identifier = "sharepoint"
url = "private-url"
weight = 10

[[menu.shortcuts]]
name = "<i class='fa fa-book'></i> Wiki"
identifier = "wiki"
url =  "private-url"
weight = 20

[[menu.shortcuts]]
name = "<i class='fa fa-globe'></i> Website"
identifier = "website"
url = "private-url"
weight = 30

Hey there,
What about your template’s layouts dir? Do you have an index.html.aspx in there at the root or in _default?

It should check both type and suffix in the lookup path, so “index.html” and “index.html.aspx” should both work. So I’m not sure what’s happening here.

Good to know!

It would have been had I been right… Not sure I am, will check when I get the time.

OK, I have checked …

So,

Your config is correct.

But have most likely a template issue. Which isn’t odd since even I didn’t remember how this worked.

This is documented in the documentation, but to recap.

For the homepage, to valid template locations for the home page would be:

/layouts/index.aspx
/layouts/index.html.aspx

I agree that it would be cool if /layouts/index.html also would just work – but you need to create an issue on GitHub to remind about that one …

Hi,

I have the following templates under layouts:

  • index.aspx
  • _default/list.aspx
  • _default/single.aspx

I have made some changes to config.toml and the following worked to at least generate an index.aspx:

[mediaTypes]
[mediaTypes."text/html"]
suffix = "aspx"

[outputFormats]
[outputFormats.ASPX]
mediaType = "text/html"
baseName = "index"
isPlainText = true

[outputs]
home = [ "ASPX", "RSS", "JSON"]
page = [ "ASPX"]

However, for the pages that didn’t work. I have also tried renaming the list.html and single.html in the _defaults folder in my theme to .aspx since I understood that Hugo will look there first but that didn’t help. When I do that, it stops generating these pages altogether…

This “remote helping by only seeing a small part of the picture” isn’t working.

I understand that you cannot show me the full site, but you then need to create a smaller running site that shows the problem. Preferably on GitHub.

Sure, I understand. I copied the Hugo site and stripped most of the content out. Hope this helps: https://github.com/chromadesign/hugo-test

Thanks a lot!

Technically if all you need to do is replace the .html extension of your html output files by aspx, all you have to do, matching this example in the doc, is add the following to your config toml:

[mediaTypes]
[mediaTypes."text/html"]
suffix = "aspx"

[outputFormats]
[outputFormats.HTML]
mediaType = "text/html"

It works with your repo.

Are you sure? It definitely doesn’t work for me…