Omar Gonzales
Omar Gonzales

Reputation: 4008

Blogdown: how to modify the index?

I need to modify the index, especially the text of my Hugo Theme.

enter image description here

I tried to modify it by opening the index.html file and make some changes, however after I run blogdown::serve_site() the index.html is back with the initial text that I had previously modified.

When I inspect the index.Rmd file, that should generate the index.html file, I only see:

---
site: blogdown:::blogdown_site
---

So how can I edit the permantly the index.html generated?

https://github.com/OmarGonD/omargonzalesdiaz

UPDATE 1

Thanks to Emi, now I have a layout folder at top level and I can delete cetain parts of the index. But still don't know how to modify the text on the carrusel.html:

I can even delete the hole carrusel.

 {{ partial "carousel.html" . }} # Need to modify the text inside here

Full index.htm:

<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">

  {{ partial "head.html" . }}

  <body>

    <div id="all">

        <header>

          {{ partial "top.html" . }}

          {{ partial "nav.html" . }}

        </header>

        {{ partial "carousel.html" . }} # Need to modify the text inside here

        {{ partial "features.html" . }}

        {{ partial "testimonials.html" . }}

        {{ partial "see_more.html" . }}

        {{ partial "recent_posts.html" . }}

        {{ partial "clients.html" . }}

        {{ partial "footer.html" . }}

    </div>
    <!-- /#all -->

    {{ partial "scripts.html" . }}

  </body>
</html>

carrusel.html:

I've also moved the carrusel.html to the top level layout folder, and when opening it I find:

{{ if isset .Site.Params "carousel" }}
{{ if .Site.Params.carousel.enable }}
{{ if gt (len .Site.Data.carousel) 0 }}
<section>
    <div class="home-carousel">
        <div class="dark-mask"></div>
        <div class="container">
            <div class="homepage owl-carousel">
                {{ range sort .Site.Data.carousel "weight" }}
                <div class="item">
                    <div class="row">
                        <div class="col-sm-5 right">
                            <h1>{{ .title }}</h1>
                            {{ .description | safeHTML }}
                        </div>
                        <div class="col-sm-7">
                            <img class="img-responsive" src="{{ .image }}" alt="">
                        </div>
                    </div>
                </div>
                {{ end }}
            </div>
            <!-- /.project owl-slider -->
        </div>
    </div>
</section>
{{ end }}
{{ end }}
{{ end }}

But not sure how to modify the text inside it

Upvotes: 0

Views: 408

Answers (1)

Emi
Emi

Reputation: 3584

If you'd like to modify the text of carousel.html, try modifying the content in

data/carousel/multipurpose.yaml

My tip is that if there's a text that you want to modify, try searching the term in a finder within your folder to see where it might be located! Where it is depends on the theme but usually a well-written theme should be easy to modify content of the website.

Upvotes: 1

Related Questions