mtinra
November 23, 2017, 7:36am
1
Hi all,
I have problem with configuration here. I tried to use Media types for change default html extension to .htm
, I put this in the config.toml
[mediaTypes]
[mediaTypes."text/html"]
suffix = "htm"
But I still get the .html
out, with my understanding, the output type for .md
files in content directory should be HTML by default. Do I need to config other places?
Many thanks!!!
Did you look at https://gohugo.io/templates/output-formats/#output-formats-for-pages ? Seems to fit for your needs, if you want to output in .htm
instead of .html
.
bep
November 23, 2017, 12:45pm
3
I will update the docs with this, as this seems to be a common use case.
bep
November 23, 2017, 12:59pm
4
I have updated the docs to reflect the way it is now. I have, however, discovered some issues that tells me that I may reconsider and simplify this.
panic: Shortcode "HAHAHUGOSHORTCODE-1HBHB" could not be found
goroutine 376 [running]:
github.com/gohugoio/hugo/hugolib.(*shortcodeHandler).contentShortcodesForOutputFormat(0xc4210adcc0, 0x1a06edf, 0x4, 0x1a081a7, 0x4, 0x1a07a63, 0x4, 0xc420377d0c, 0x3, 0x1a05325, ...)
/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:395 +0x659
github.com/gohugoio/hugo/hugolib.(*shortcodeHandler).updateDelta(0xc4210adcc0,...
Bug
1 Like
mtinra
November 23, 2017, 2:32pm
5
Thank you vary much, I will follow the issue.
bep
November 23, 2017, 2:38pm
6
I would suggest you start by following the updated documentation.
mtinra
November 23, 2017, 2:53pm
7
Hugo version v0.30.2
with updated document in confilg.toml
I added
[mediaTypes]
[mediaTypes."text/html"]
suffix = "htm"
# Redefine HTML to update its media type.
[outputFormats.HTML]
mediaType = "text/html"
this time, it not have any content exported except xml files. I also addedβ¦
disableKinds = ["home"]
[outputs]
page = ["HTML"]
now only one sitemap.xml
came out.
This is my directory tree:
βββ archetypes
β βββ default.md
βββ config.toml
βββ content
β βββ about.md
βββ data
βββ layouts
β βββ _default
β βββ single.html
βββ static
βββ themes
bep
November 23, 2017, 3:00pm
8
I suspect you have some invalid TOML, but it is impossible for me to see without the full source.
mtinra
November 23, 2017, 3:02pm
9
this is all in my config file just only minimum settingβ¦
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
disableKinds = ["home"]
[mediaTypes]
[mediaTypes."text/html"]
suffix = "htm"
# Redefine HTML to update its media type.
[outputFormats.HTML]
mediaType = "text/html"
[outputs]
page = ["HTML"]
bep
November 23, 2017, 3:19pm
10
I have updated the docs. I was a little bit fast in my βcopy-pasteβ from my test.
mtinra
November 23, 2017, 4:03pm
11
I may doing something wrong, it still not working.
I have go back to start from the beginning by these steps.
# Hugo Static Site Generator v0.30.2
$ hugo new site ext-test
$ cd ext-test
$ hugo new about.md
add a bit content to ./content/about.md
then create file ./layout/_default/single.html
with this simple html code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
{{ .Content }}
</body>
</html>
this is the config.toml file
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
[mediaTypes]
[mediaTypes."text/html"]
suffix = "htm"
# Redefine HTML to update its media type.
[outputFormats]
[outputFormats.HTML]
mediaType = "text/html"
finally hugo -D
and this is the final output:
βββ archetypes
β βββ default.md
βββ config.toml
βββ content
β βββ about.md
βββ data
βββ layouts
β βββ _default
β βββ single.html
βββ public
β βββ categories
β β βββ index.xml
β βββ index.xml
β βββ sitemap.xml
β βββ tags
β βββ index.xml
βββ static
βββ themes
it is not has ./public/about/index.htm
file
bep
November 23, 2017, 4:28pm
12
If you can share a link to the full source, I can have a look at it. Looking at small snippets isnβt helping, obviously.
mtinra
November 24, 2017, 3:55am
14
I have created a github repo for full source code hereβ¦
Thanks for your time.
dpraen1
November 24, 2017, 4:15am
15
I notice you have draft = βfalseβ in your about.md contact page, I think this must be a typo.
mtinra
November 24, 2017, 4:43am
16
oh that my bad, fixed, thank you
With this current setup itβs still not export .htm fileβ¦
akissz
November 29, 2017, 2:23am
17
I tried this. But I donβt get it. Do you need to make both config files? I did. And that still didnβt function how explained. Can you explain more simple what is required to make the custom extensions function? Thanks!