Hello everyone, I am currently trying to implement a site in Hugo which would allow to browse 3D models submitted by FreeCAD contributors.
The site will by used in conjuction with a FreeCAD Workbench to easely import the models, as for now the only option is to download models one by one or the entire library.
I am currently trying to create the base structure of the site and I am having difficulties with the linking of some pages.
To make maintaining the site easier, I used the DRY process and set up the navbar in a template :
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
<button class="btn btn-dark" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasScrolling" aria-controls="offcanvasScrolling"><i class="bi bi-list"></i></button>
<a class="navbar-brand" href="{{.Site.BaseURL}}">
{{ with resources.Get "images/navbar/FreeCAD-wordmark-dark.svg" }}
<img class="navbar-img" src="{{.RelPermalink}}" width="140" height="40" alt=""></a>
{{ end }}
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href=""></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</li>
<li class="nav-item">
{{$about:= .Site.GetPage "about" }}
<a class="nav-link" href="{{ $about.RelPermalink }}">About</a>
</li>
</ul>
</div>
</div>
</nav>
The 1st part that bugs me is the linking of the about page.
The principle is the following:
- Create a template called about.html
- Apply this template to a about.md file to make writing the content easier.
- link the produced html file in the sidebar.
First the linking. I tried to use the GetPage method, but when I add <p>test</pd
in the about page, I don’t see the paragraph in the page. What would be the best in this case?
Second, displaying the content of the file. I tried to add the Content Method like so:
{{ with resources.Get "content/about.md" }}
{{ .Content }}
{{ end }}
but it didn’t work. What would be the best to set the template to render the content of the .md file?
Thx in advance