Search code examples
htmlcsshugotoml

How to make a paragraph in Hugo?


I've built a website with Hugo. In the config.toml, there are a few lines as below:

[params]
    name = "My name"
    description = "Blog Description"
    bio = "Data Analyst at [@X](https://www.x.com/)" 

Now, I'd like to add one more to my blog in bio like this:

[params]
    name = "My name"
    description = "Blog Description"
    bio = "Data Analyst at [@X](https://www.x.com/)" 
    "previously at [@Y](https://www.y.com/)" 

However, it does not come out. What am I making wrong here? HTML code with p did not work as well.


Solution

  • bio = "Data Analyst at [@X](https://www.x.com/) <br /> previously at [@Y](https://www.y.com/)"
    

    if the <br /> or <p> or whatever you decide to put there renders as "<br..." etc. Then wherever site.Params.bio or .Site.Params.bio is (in the layouts etc), add "| safeHTML" i.e. {{ .site.Params.bio | safeHTML }}

    Or just ask the theme maintainer to add whatever you want.

    Note: You could just add a new bit in whatever template you wish to output this, example

    bio = "Data Analyst at [@X](https://www.x.com/)"   
    more_bio = "previously at [@Y](https://www.y.com/)" 
    

    {{ .Site.Params.more_bio }} <- put that wherever you want it to output (in whatever layout)

    Etc...

    https://gohugo.io/variables/site/