SteveLane / hugo-icon

Icon theme for Hugo
MIT License
87 stars 67 forks source link

Use section page templates instead of config.toml #28

Open SteveLane opened 5 years ago

SteveLane commented 5 years ago

Originally posted by @braian125 in https://github.com/SteveLane/hugo-icon/pull/27#issuecomment-481309878


When I refer to base template, I don't only refer to not limiting the use of the content from the config.toml (It's well done), but instead, expand and promote the use of section page templates, the theme that you publish is amazing, but with great respect, I made changes to improve the ease of making publications in a production site:

  1. The menu you implement it from the config.toml
    # Navigation section
    [params.nav]
    mission = "Our Mission"
    services = "Services"
    team = "The Team"
    contact = "Get In Touch"
    # Include logo instead if HOME:
    # logo = "path/to/logo"

    I preferred to use the front matter method of defining menu entries:

<ul class="fh5co-menu-1" aria-label="menu">`
   {{ $current := . }}
   {{ range .Site.Menus.main }}
        <li class="" aria-label="{{ .Name }}">
           <a href="{{ .URL }}" data-nav-section="{{ lower .Name }}" class="menu__items__item__link {{ if $current.IsMenuCurrent "main" . }}active{{ end }}" alt="{{ .Name }}" role="menuitem">
                {{ upper .Title }}
           </a>
       </li>
  {{ end }}
</ul>
  1. The content of the site is limited to changing the config.toml, and I think it is more efficient to link it to Front Matter, so I deleted a certain logic from its configuration file and adapted it to the folder content.

image

{{ range first 3 (where .Site.RegularPages ".Type" "areas") }}
     <div class="col-md-6">
          <div class="service">
               <div class="icon"><img src="{{ .Params.icon }}"></div>
               <h3>{{ .Title | markdownify }}</h3>
               <p>{{ .Content | markdownify }}</p>
          </div>
    </div>
{{end}}