Open cpah opened 1 week ago
Have you checked the Site
protocol?
It contains a var favicon: URL? { get }
Many thanks; I had not noticed that protocol entry. I added a favicon.ico file to my Assets/images folder and rebuilt my site with var favicon = URL("/images/favicon.ico”)
inserted into my Site.swift file. Sadly, it had no effect and my Build/index.html file was unaltered from its original version. However, if I insert <link rel="icon" type="image/x-icon" href="/images/favicon.ico”>
after </title>
in my Build/index.html file with a text editor and then refresh my localhost in Safari (after clearing its caches), the favicon appears. I guess, therefore, that the favicon var is not (yet?) being processed in Ignite and live in hope that it will be in a future release.
favicon in general works with Ignite. Not sure if this is related to this issue, but I use a png for the favicon and it works on Safari, Firefox etc.
I guess, therefore, that the favicon var is not (yet?) being processed in Ignite and live in hope that it will be in a future release.
You'll definitely have more luck with a speedy resolution by contributing a fix 🙂
Oops, sorry Paul. I'm really not sure where to begin - but I will have a go ...
I believe the problem may lie in the Sources/Ignite/Elements/Head.swift file here.
I note that the code at line 90:
MetaLink(href: page.url, rel: "canonical")
results in <link href="https://www.crizzle.co.uk/" rel="canonical">
being added to the
if let favicon = page.favicon {
MetaLink(href: favicon, rel: .icon)
}
Adding <link href="/images/favicon.ico" rel=".icon">
to the
Sorry. The 'section' of 'section of the home page's index.html file' is the head></head>
'section'. Also, I should have added that the fix will add the favicon entry to the head></head>
sections of all of a site's pages' index.html files :-)
Please could you provide a capability to add a Favicon to Ignite-generated websites? As I understand it, an extra
link
section would need to be added after thetitle
section, as shown in the (W3 Schools) example below:Perhaps this could be achieved by adding a new var to the Site
struct
. In your BrushAnd Bark example thisstruct
would become:The
head
section in the home page's index.html file, generated in your BrushAndBark example, should (I presume) then become: