keywind icon indicating copy to clipboard operation
keywind copied to clipboard

favicon is broken

Open kantum opened this issue 2 years ago • 7 comments

If you add the property favicons, it breaks the template engine.

Looks like a typo in document.ftl:

  <#if properties.favicons?has_content>
    <#list properties.favicons?split(" ") as favicon>
      <link href="${url.resourcesPath}/${favicon?split('==')[0]}" rel="${meta?split('==')[1]}">
    </#list>
  </#if>

rel should be "icon" not something in meta

This works:

  <#if properties.favicons?has_content>
    <#list properties.favicons?split(" ") as favicon>
      <link href="${url.resourcesPath}/${favicon?split('==')[0]}" rel="icon">
    </#list>
  </#if>

kantum avatar Dec 16 '22 16:12 kantum

Did you manage to add a favicon? I'm currently struggling with this

madmurl0c avatar Mar 02 '23 14:03 madmurl0c

Yes, I updated the code in the issue as I also made a typo :smile:

  1. Update the document.ftl in keywind: replace rel="${meta?split('==')[1]}" with rel="icon"
  2. Add the favicon in resources/img/favicon.ico
  3. Update your theme.properties with favicons=img/favicon.ico

kantum avatar Mar 02 '23 15:03 kantum

Now it works, thanks a lot. Previously I put the favicon in /login/assets/img/favicon.ico but that path didn't work, of course it needs to be under resources.

Hopefully your bugfix gets added to the repo soon :)

madmurl0c avatar Mar 02 '23 16:03 madmurl0c

Sorry for the late reply. You are right. There is indeed an error in this part of the code. The idea was to allow rel to be configurable, as sometimes rel="apple-touch-icon", for example, may be required. This should work.

document.ftl

<#if properties.favicons?has_content>
  <#list properties.favicons?split(" ") as favicon>
    <link href="${url.resourcesPath}/${favicon?split('==')[0]}" rel="${favicon?split('==')[1]}">
  </#list>
</#if>

theme.properties

favicon=img/favicon.ico==icon

lukin avatar Mar 02 '23 17:03 lukin

Haven't thought about that but great idea

madmurl0c avatar Mar 02 '23 20:03 madmurl0c

This should be fixed with c5ab06d.

lukin avatar Mar 03 '23 23:03 lukin

Sorry for the late reply. You are right. There is indeed an error in this part of the code. The idea was to allow rel to be configurable, as sometimes rel="apple-touch-icon", for example, may be required. This should work.

document.ftl

<#if properties.favicons?has_content>
  <#list properties.favicons?split(" ") as favicon>
    <link href="${url.resourcesPath}/${favicon?split('==')[0]}" rel="${favicon?split('==')[1]}">
  </#list>
</#if>

theme.properties

favicon=img/favicon.ico==icon

Hi there~ it should be favicons=img/favicon.ico==icon

Lexachoc avatar Mar 04 '24 20:03 Lexachoc