I am developing a static web application using Hugo with Docsy theme. I would like to add an condition within Docsy Partials code where I would like to append the mailTo: word to my .url if the .mail is set to true, when I try to do this then I get the following error:
/themes/docsy/layouts/partials/footer.html:36:34": execute of template failed at <.url>: can’t evaluate field url in type bool
@jmooring
Sorry, but It is not posted anywhere on the public repository. I am using the Docsy theme and following are the data defined within my config.toml:
[params.links]
# Developer relevant links. These will show up on right side of footer and in the community page if you have one.
[[params.links.developer]]
name = "Example"
url = "https://www.example.com/"
mail = false
[[params.links.developer]]
name = "GitHub"
url = "https://github.com/example"
mail = false
[[params.links.developer]]
name = "Contact us"
url = "info@example.com"
mail = true
I am trying to check and add the with condition in my partials/footer.html:
This is true, but it occurs while iterating through an array with range (this is the detail missing from your original post). The simplest way to handle this is to use if instead of with because there is no need to rebind the context:
Also, instead of modifying the theme directly, it is better to override the files as needed by placing a copy in the layouts directory in the root of your project.