Is there anything wrong with using relURL to obtain favicons from the static folder?

Hello,
I have the following code in my baseof.html file, and although it works, I’m curious if this approach is considered good practice.
The favicon image files are located in the static folder within the themes/mytheme folder.

 {{ "<!-- Favicon -->" | safeHTML }}
 <link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | relURL }}">
 <link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | relURL }}">
 <link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | relURL }}">
 <link rel="shortcut icon" href="{{ "favicon.ico" | relURL }}">
 <link rel="manifest" href="{{ "manifest.json" | relURL }}">

I would be grateful for any suggestions. Thank you!

This is the correct way to do it.

Letting Hugo build URLs avoids a lot of hassel down the road.

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.