Seeking help for a (hopefully) easy modification of the Hugoplate theme

Hi,

This is my first post here. I’ve used the Themefisher Meghna theme for my website but I’d like to refresh it and I found that the Hugoplate ( GitHub - zeon-studio/hugoplate: Hugoplate is a free starter template built with Hugo and Tailwind CSS v4.0 that will save you hours of work. ) theme suits my needs. I’ve started playing around, and so far so good ( https://gitlab.com/sguyader/fullmix_studio ).

Now, something I’d like to try is put the banner image as a background image to the banner section, with the banner’s .title and .content on top of it. But that’s beyond my skills. I’ve tried asking for help to a couple LLMs, but their answers are too generic.

So, if someone here can help me out that would be great. Thanks!

From what I can see, this theme has no documentation about its configuration options at all. So, it might not be the best choice for a Hugo newbie. Since Hugoplate does come from a company, they might be the best source to answer your questions.

Aside: I would suggest that newbies start with a minimal theme or none at all, building whatever they need themselves. That way, they know (or at least can learn) what’s going on and how/which wheels are turning.

As to your original question: I’d create a flex box containing the image (not as a background-image, though), the title, and the content as children. It’s fairly easy to position the text then.

1 Like

Thank you for your answer. I already sent a request to the company (Zen Studio), but since I don’t know how much it will cost me to get their help, or how long it would take to get a response from them, I figured I could ask here as well.

And thanks for your suggestion to create a flex box, I’ll try that.

I found a not perfect but good enough solution. Instead of using a flex box, I modified the html layout for the home page, in which the banner is defined. It uses some tailwind css, and by moving the image div before the title and content, removing the image’s sizing parameters and playing with the title and content div position I was able to get pretty much the result I wanted.

The banner part of the code goes from:

  <!-- Banner -->
  {{ with .Params.banner }}
    <section class="section pt-14">
      <div class="container">
        <div class="row justify-center">
          <div class="lg:col-7 md:col-9 mb-8 text-center">
            <h1 class="mb-4 text-h3 lg:text-h1">
              {{ .title | markdownify }}
            </h1>
            <p class="mb-8">
              {{ .content | markdownify }}
            </p>
            {{ with .button }}
              {{ if .enable }}
                <a
                  class="btn btn-primary"
                  href="{{ .link | absURL }}"
                  {{ if strings.HasPrefix .link `http` }}
                    target="_blank" rel="noopener"
                  {{ end }}>
                  {{ .label }}
                  <i class="fa fa-arrow-right pl-2"></i>
                </a>
              {{ end }}
            {{ end }}
          </div>
          <div class="col-12">
            {{ partial "image" (dict "Src" .image "Alt" "Banner image" "Loading" "eager" "Class" "mx-auto lg:!max-w-[800px]" "DisplayXL" "800x" ) }}
          </div>
        </div>
      </div>
    </section>
  {{ end }}
  <!-- /Banner -->

to:

  <!-- Banner -->
  {{ with .Params.banner }}
    <section class="section pt-14">
      <div class="absolute">
        {{ partial "image" (dict "Src" .image "Alt" "Banner image" "Loading" "eager") }}
      </div>
      <div class="relative top-20 container">
        <div class="row justify-center">
          <div class="lg:col-7 md:col-9 mb-8 text-center">
            <h1 class="mb-4 text-h3 lg:text-h1">
              {{ .title | markdownify }}
            </h1>
            <p class="mb-8">
              {{ .content | markdownify }}
            </p>
            {{ with .button }}
              {{ if .enable }}
                <a
                  class="btn btn-primary"
                  href="{{ .link | absURL }}"
                  {{ if strings.HasPrefix .link `http` }}
                    target="_blank" rel="noopener"
                  {{ end }}>
                  {{ .label }}
                  <i class="fa fa-arrow-right pl-2"></i>
                </a>
              {{ end }}
            {{ end }}
          </div>

        </div>
      </div>
    </section>
  {{ end }}
  <!-- /Banner -->

Do not make changes directly to the theme. Copy the file you edited to the same path in the root of yout project and make the changes there.

2 Likes

Thank you, that’s a good tip.

The “solution” I found earlier is not great, it works okay until I open the page on a large screen, then the image is enlarged and overlaps the following section.

In the tailwind documentation, I found that there is an easy way to define a background for any section or div. It can be a colour or or an image. I’m now able to see the effect of changing the background to the banner section with class="bg-pink-500" for example (I can change the colour to pink successfully). But if I try to provide the url to the image with class="bg-[url(/assets/images/banner.jpeg")] the image is not displayed. I tried to set the image url relative to the html file, but still nothing.

I have a section of my site with code like that. Try it and replace img/bg.jpg with your own in the assets directory. Make other changes to your liking.

<header class="relative flex justify-center items-center mt-5 w-full h-[80vh] overflow-hidden text-center">
    {{- with resources.Get "images/bg.jpg" }}
      {{- with .Process "Fill 1080x720 webp Center" }}
        <img class="top-0 left-0 z-0 absolute w-full h-full object-center object-cover" src="{{ .RelPermalink }}" alt="" width="{{ .Width }}" height="{{ .Height }}">
      {{- end }}
    {{- end }}
    <div class="z-10 relative bg-black/90 px-5 py-15 rounded-md text-white">
      <h2 class="pb-8 font-sans-bold text-4xl leading-none">Lorem Ipsum Dola Sit Amet</h2>
      <p class="pb-10 font-sans-bold text-xl">Lorem Ipsum Dola Sit Amet</p>
      <a href="/categories/" class="inline-block">Categories</a>
    </div>
  </header>
1 Like

Your solution works. Now I have to find how to control the size of the image. Thanks a lot!

Adjust those valies. If you don’t need webp or centred image, remove webp Center. Also h-[80vh] also controls the height. Remove or use Tailwind CSS defaults.

1 Like

Even if your solution works, my problem is that I have a multilingual site, and your solution works for only one language, or at least not easily with more than one language.

For now I’ll leave the image after the text, but I hope I can find a good solution.

So far I had no luck with LLM’s, but today I tried the latest Gemini 3 Pro LLM, and it got me pretty much there on the second try.

{ with .Params.banner }}
  <section class="my-banner relative py-32 lg:py-52 overflow-hidden">
    <div class="absolute inset-0 w-full h-full z-0 opacity-[.80]">
      {{ partial "image" (dict 
          "Src" .image "Alt" "Banner background" "Loading" "eager" "Class" "w-full h-full object-cover" "DisplayXL" "1520x" 
      ) }}
    </div>
    <div class="container relative z-10">
      <div class="row justify-center">
        <div class="lg:col-7 md:col-9 text-center backdrop-blur-sm p-8 md:p-12 rounded-xl shadow-lg">
          <h1 class="mb-4 text-h3 lg:text-h1">
            {{ .title | markdownify }}
          </h1>
          <p class="mb-8">
            {{ .content | markdownify }}
          </p>
        </div>
      </div>
    </div>
  </section>
{{ end }}

Now I just have to figure out how I can combine the blurred text box background combined with a gray tint to make a better separation from the image background.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.