[SOLVED]: Entering a two-line value for a configuraton key in config.toml

I am thinking of a two-line copyright for my site.

According to the toml documentation I could for instance write in config.toml the following:

copyright = "My name\nLinks to Hugo and Theme"

but it does not seem to work.

Is this because of CSS styling or have I understood the toml docs incorrectly?

Thanks.

Don’t you need a leading " on the value?

Mea Culpa: I have edited it above but I tried it with matched "s and could not get it to work.

Try

str1 = """
Roses are red
Violets are blue"""
1 Like

You are referring toml documentation, but the syntax is yaml’s.

YAML (colons):

foo: "bar"

TOML (equals):

foo = "bar"

Another error of mine: I have corrected it in the question. I meant toml. Thanks.

Now you either show your site source that shows this problem, or try what @bep suggested :slight_smile:

Look here: https://github.com/toml-lang/toml

And here: https://npf.io/2014/08/intro-to-toml/

https://gohugohq.com/howto/toml-json-yaml-comparison/

I have cut and pasted your text into the copyright string and got the attached rendering.copy

The results perplex me.

Could it be styling done afterwards to enforce a single line copyright?

I am new to this and my site is not online. It is local, and I am trying to customize the hugo-icarus-theme a little to suit my needs.

In any case, the results have been posted.

Even if your site is not online, you can share the site source online (assuming you can legally do that) on places like Gitlab and GitHub.

Assuming that that copyright param expects a Markdown value, you would need to use a blank line to force a new paragraph in HTML.

There is no site code from me.

I am simply changing values in the config.toml file for the Icarus theme in Hugo.

This file is part of the hugo-icarus-theme and I am changing the value for the copyright key in config.toml so:

copyright = "My name\nLinks to Hugo and Theme"

Note that the exampleSite of the Icarus theme is a fully working site and is very convenient for making small configuration changes and seeing their effect almost at once.

So far, I have not been able to get the copyright to display on two lines. I am unsure why. Hence my question.

If you are able to help, I shall endeavour to provide any further details you ask for.

Thanks.

Did you try:

you would need to use a blank line to force a new paragraph in HTML.

I.e:

copyright = """Line 1

Line 2"""

Blank line above Line 2 matters.

Yes. Your comment that a blank line was necessary was most helpful.

But it gives three lines instead of two.

    copyright  = """My name
    
Links to Hugo and Theme"""

gives
three-lines

So, I am able to get either a one-line or a three-line output for the copyright notice but not the two lines I am seeking.

I shall try some more.

Thank you.

Hmm, I’m still on phone, not at a computer… so all guess work… try:

copyright = "Line1<br />Line2"
1 Like

That worked!

Thank you @kaushalmodi. :slight_smile:

The text

copyright = "My name<br />Links to Hugo and Theme"

gave me

two-lines

This is exactly what I was aiming for.

I have also taken a look at this thread.

and taken a look at the Icarus file:

layouts/partials/footer.html

It has these lines:

<footer id="footer">
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; {{ now.Format "2006"}}
      {{ with .Site.Params.copyright }}{{ . | markdownify}}{{ end }}
    </div>
  </div>
</footer>

where I suspect that markdownify might be the cause of the different interpretations given to \n in the experiments above.

Thanks for helping me learn and also for suggesting the solution.