Some tips on using Hugo

Tips on keep your html code as it is and to prevent lowercasing urls.

Have been using Hugo for creating several static sites. Recently just struggled with some problems:

How to keep your html content as HTML code

By default Hugo will convert every code in your .md files into html format, which means if you have the follwing lines:

<div> div1</div>
<script src="">...</script>

<div> div2 </div>

It will become something like this:

<p <div> div1</div>
<script src="">...</script> />

<p <div> div2 </div> />

Which leads to the html codes not been interpretated by the browser.

To keep the html code in {{ .Conten }} as it is, enclose them into a big

such as:

HTML code here

How to prevent the URLs to be transformed to lowcases

To use /post/This-is-a-Test instead of /post/this-is-a-test, add the below line in the config.toml

disablePathToLower = true

But the problem is that if you have a content folder in Uppercase, the corresponding template for this folder will not work.

comments powered by Disqus
CC-BY-NC 4.0
Built with Hugo Theme Stack