lukin / keywind

Keywind is a component-based Keycloak Login Theme built with Tailwind CSS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

favicon is broken

kantum opened this issue · 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>

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

commented

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

  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

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 :)

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

Haven't thought about that but great idea

This should be fixed with c5ab06d.

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