Hi all,
I haven’t used HUGO in a few years and going back to it now. It worked back then but I think using newer version of HUGO no longer works. But is there a way to get this working below? It works if I paste the {{ .Site.Data.appearance.colors_primary_button_background_color }} into the main index.html file, but once it goes into the :root style or head, it doesn’t work. Am I overlooking something simple? Thanks!
<style>
:root {
--primary-button-background: {{ .Site.Data.appearance.colors_primary_button_background_color }};
--primary-button-text-color: {{ .Site.Data.appearance.colors.primary_button_text_color }};
--primary-link-color: {{ .Site.Data.appearance.colors.links }};
--primary-accent-color: {{ .Site.Data.appearance.colors.accent }};
--idx-title-color: {{ .Site.Data.appearance.colors.idx_title_background_color }};
--idx-title-text-color: {{ .Site.Data.appearance.colors.idx_title_text_color }};
}
</style>
frjo
September 1, 2023, 6:16pm
2
trace751:
:root style or head
What or where is this?
Post a link to your repo and it will be mush easier to help you.
Thanks for your quick response! Here is the link to the head file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{- $colors := .Site.Data.appearance -}}
<script src="https://cdn.tailwindcss.com"></script>
<!-- SCHEMA -->
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
<style>
:root {
--primary-button-background: {{ .Site.Data.appearance.colors_primary_button_background_color }};
--primary-button-text-color: {{ .Site.Data.appearance.colors_primary_button_text_color }};
--primary-link-color: {{ .Site.Data.appearance.colors.links }};
--primary-accent-color: {{ .Site.Data.appearance.colors_accent }};
--idx-title-color: {{ .Site.Data.appearance.colors.idx_title_background_color }};
--idx-title-text-color: {{ .Site.Data.appearance.colors.idx_title_text_color }};
}
This file has been truncated. show original
frjo
September 1, 2023, 6:38pm
4
When you call the partials in index.html
you forgot to give the partial a context.
It should look like this
{{ partial "global/head" . }}
{{ partial "global/navbar" . }}
Notice the dot set as the second argument.
Read more at Partial templates | Hugo .
1 Like
I think that did it! Thank you!
system
Closed
September 4, 2023, 6:58am
6
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.