Greetings. Using the Academic theme. I would like add a line break to my “Affiliation” information, which is defined in the TOML of the config.toml file.
# Organizations/Affiliations.
# Separate multiple entries with a comma, using the form: `[ {name="Org1", url=""}, {name="Org2", url=""} ]`.
organizations = [ { name = "Department of Management and Entrepreneurship, W.P. Carey School of Business, Arizona State University", url = "" }]
Can anyone tell me how to introduce a line break between, say, “…Entrepreneurship,” and “W. P. Carey…”? I’ve tried , putting the string in triple quotes and adding two blank lines, etc. No luck. I’ve also added extensions = ["hardLineBreak"] in the [Blackfriday] configuration section on config.toml.
You tried markdown options, but is that markdown? The theme takes those values and somehow produces HTML, but you will need to check to see if it is parsed as markdown, or something else is happening.
Also, you will probably have better luck asking the theme author, as they will know how that parameter is used in the theme.
Thank you. Quite new to Hugo overall. Can you please tell me where I would include the instruction {{ with .Params.organizations }}{{ . | safeHTML }}{{ end }} to control the rendering? Much appreciated.
Chiming in, you can put {{ with .Params.organizations }}{{ . | safeHTML }}{{ end }} where it makes sense anywhere in your templates. Like, the theme had that on a bio page, but you wanted it in your footer, you can do it.
For future reference and as requested, a summary of how I got this to work. My solution is specific to the Academic theme in its details, but should generalize. Also, I can only say that it works, not that it is the best way to do it.
Searched in my project to find “.Params.organizations,” finding it in themes/academic/layouts/partials/widgets/about.html.
Copied that file to [Root file of my project]/layouts/partials/widgets/about.html, creating the necessary directories along the way. This is the file I edited, since it will override the theme’s version.
Discovered the relevant block in the file.
{{ range $.Site.Params.organizations }}
<h3 itemprop="worksFor" itemscope itemtype="http://schema.org/Organization">
{{ with .url }}<a href="{{ . }}" target="_blank" itemprop="url" rel="noopener">{{ end }}
<span itemprop="name">{{ .name }}</span>
{{ if .url }}</a>{{ end }}
</h3>
{{ end }}
</div>
Modified the fifth line thereof with the addition of | safteHTML. It now reads
In the config.toml file, added <br> where I wanted linebreaks in the entry for organization. It now reads
# Organizations/Affiliations.
# Separate multiple entries with a comma, using the form: `[ {name="Org1", url=""}, {name="Org2", url=""} ]`.
organizations = [ { name = "W.P. Carey School of Business <br> and <br> Julie Ann Wrigley <br>Global Institute Of Sustainability,<br> Arizona State University", url = "" }]