BreadCrumbs upgrade

    {{ template “breadcrumbnav” (dict “p1” . “p2” .) }}

{{ define “breadcrumbnav” }}

{{ if .p1.Parent }}

{{ template “breadcrumbnav” (dict “p1” .p1.Parent “p2” .p2 )}}

{{ else if not .p1.IsHome }}

{{ template “breadcrumbnav” (dict “p1” .p1.Site.Home “p2” .p2 )}}

{{ end }}

  • {{ .p1.Title }}

  • {{ end }}

    i want to name my home page myself

    And in the indiceted place i need use construction .Params.Pretitle.

    Please Help Me power peaple!

    Hi, I’m not sure what you mean by that.

    If you want to give your homepage a specific title, you need to create a file called _index.md (I think _index.html works too, but I only use .md files) in the /content folder.
    Then, in that file, you can specify a title. For instance, with TOML format, you could write:

    +++
    title = "Your New Home Page Title"
    +++
    

    As for your other question, I think there are two parts to the solution:

    1. In every article that you want to publish (i.e. in every .md or .html file that you create in the /content folder), if you want to have a pretitle, you would add (again, I’m using TOML):
    +++
    pretitle = "Your Pretitle"
    +++
    

    Maybe you would like to have a pretitle for some articles, but not all. Then you can include the line in some articles, but not others - it should be fine.

    1. In /layouts/_defaults/single.html (or in another file, maybe /partials/header.html if your <h1> is there like mine), where you want the pretitle to appear, you would put:
    {{ with .Params.pretitle }}
    <p>{{ . }}</p>
    {{ end }}
    

    You would only need to do this once.
    Here, “with” means that the paragraph would only appear when you have specified a pretitle in your article (the .md or .html file in the /content folder).
    Of course you can replace <p> with another HTML tag and add attributes.

    I hope this answers your questions. Please note that I didn’t test this solution, it is based on my own code.


    Hi, I’m new to the Hugo forums and not used to answering questions about Hugo. If I made a mistake or something isn’t clear, please be gentle :slight_smile:

    1 Like

    thank for help. I need to do it myself. Its my fault, becouse my english is not very clear))