Your theme already have a sidebar so you only need to populate it.
Start by adding a new favourite content type, i.e. create a new directory inside the “content” directory. Lets name it “favourite” for this example.
Add all the favourites you need, one content post for each. A post could be as simple as this, only frontmatter with title and link.
---
title: "Example"
link: "https://www.example.org/"
---
Now you need to update your layout templates to render these favourite links.
Inside your root layouts directory create
-
partials/widgets/favourites.html
. Maybe something like this.
<ul>
{{ range where .Pages "Type" "favourite" -}}
{{ .Render "link" }}
{{ end -}}
</ul>
-
_default/link.html
, see “link” in the render statement above. Simplest version is.
<li><a href="{{ .Params.Link }}">{{ .Title }}</a></li>
(Since link is a custom variable in the frontmatter it’s accessed via .Params.)
Copy layouts/partials/sidebar.html
from the theme to the same location inside you root layouts directory. (If you edit it in place it will work, but when you update your theme your changes will be overwritten. Best practice is to copy it to the root and edit it there.)
In the copied sidebar.html add the the new favourite widget where you want to display the links. Use this code.
{{ partial "widgets/favourites" . }}
This part with dividing up the sidebar template in “widgets” is just how your theme does it, it has nothing to do with Hugo.