HiNinoJay/hexo-theme-A4

Customized favicon 404 on Non-index pages -- Possible cause & Possible fix

Closed this issue · 1 comments

Thanks for spending time viewing this issue, and hope this will be of some help.

After changing favicon in _config.a4.yml the theme will be unable to locate exact location of modified favicon path.

E.g. If the config is modified as follows:

# 相对于source目录下的头像url
favicon: /img/favicon.jpeg

This is what the page looks like:
ScreenCapture

The issue is possibly caused by codes in /blob/main/layout/_partial/post-header.ejs where the avatar is defined as follows:

    <div class="header-container">
        <img style="
        width: 56px;
        height: auto;" alt="^-^" cache-control="max-age=86400" class="header-img" src="<%- url_for('/img/favicon.webp') %>" width="10%"></img>
        <div class="header-content">
            <a class="logo" href="<%- url_for() %>"><%= config.title %></a> 
            <span class="description"><%= config.description %></span> 
        </div>
        
    </div>

Changing url_for('/img/favicon.webp') into url_for(theme.favicon) fixes this issue.
capt2

nice issue, thanks a lot.🍺

The problem has been fixed.

If you are using git installation, you can pull down the code again.
If you use npm, it will be updated in the next version. v1.8.4 has been released