Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change favicon in docker? #3929

Closed
2 tasks done
jeffshead opened this issue Dec 25, 2022 · 6 comments
Closed
2 tasks done

How to change favicon in docker? #3929

jeffshead opened this issue Dec 25, 2022 · 6 comments
Milestone

Comments

@jeffshead
Copy link

jeffshead commented Dec 25, 2022

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

Use custom favicon. Isn't there a way to do this by adding a volume entry in the Portainer stack?

I have tried numerous lines but none work. For example:

...
 volumes:
      - /path/to/local/config:/config
      - /path/to/local/favicon.ico:/bookstack/public/favicon.ico
...
...
 volumes:
      - /path/to/local/config:/config
      - /path/to/local/favicon.ico:/public/favicon.ico
...

If I use the following, the favicon appears to have been replaced but I only get a "File not found" error on the page and I cannot access the site:

...
 volumes:
      - /path/to/local/config:/config
      - /home/docker/bookstack/favicon.ico:/app/www/public/favicon.ico
...

Exact BookStack Version

v22.11.1

Log Content

No response

PHP Version

Whatever comes with the Docker image

Hosting Environment

AlmaLinux 8.7 host, Portainer, Nginx Proxy Manager

image: lscr.io/linuxserver/bookstack
@liuhuanshuo
Copy link

I had a question similar to yours

#3973

I use docker to deploy the website just like you. Adding some custom content should not be done in dockerfile or docker-compose.yaml, it needs to be placed in a custom theme folder. Anyway, I implemented it

@jeffshead
Copy link
Author

jeffshead commented Jan 20, 2023

@liuhuanshuo
Thanks for sharing. I understand the basics of how BookStack theming works but I do not see how one can change the favicon (internally) via a custom theme. I see that there is a favicon.ico in the /public directory but I do not see it referenced in any of the files under the /resources directory or referenced in any of the other files for that matter.

The only way that I have been able to change the favicon is by specifying a favicon that is hosted on a different site. I did this by adding the following line of code within the <head> tags of /themes/theme_name/layouts/base.blade.php:

<link rel="icon" href="https://www.example2.com/favicon.ico" sizes="any" type="image/x-icon">

Definitely not an ideal solution but it works.

@liuhuanshuo
Copy link

liuhuanshuo commented Jan 22, 2023

Definitely not an ideal solution but it works.

You are right, replacing files is not the best solution

I searched for more related questions and finally I found the answer

https://www.reddit.com/r/BookStack/comments/xqp41o/changing_favicon/

As mentioned in the above link, we only need to add a line of code in the settings of the web version, and it works for me.

<link rel="icon" href="https://example.com/url-to-icon.png" />

@jeffshead
Copy link
Author

I searched for more related questions and finally I found the answer

https://www.reddit.com/r/BookStack/comments/xqp41o/changing_favicon/

I actually tried that before posting this issue. It did not work for me when I first tried it. Since you confirmed it worked for you, I removed my override base.blade.php and tried adding that line of code in the admin settings and it worked this time! I'm guessing my browser cache did not fully clear the last time I tried it.

Still, I wish there was a simple way to use an internal image file instead of pulling the icon from an external site.

@jeffshead
Copy link
Author

So here is how I am currently using an internal image:

  1. Manually upload the favicon image file to the same directory as your custom logo.
    1. My host path: /.../config/www/uploads/images/system/2022-12/favicon.svg
    2. The resulting URL: https://example.com/uploads/images/system/2022-12/favicon.svg
  2. Add this line to the Settings->Customization->Custom HTML Head Content input box in the BookStack admin:
    1. <link rel="icon" href="uploads/images/system/2022-12/favicon.svg" sizes="any" type="image/svg+xml">

Anyone, please feel free to comment if there is a better way.

@ssddanbrown
Copy link
Member

@jeffshead Glad to see you found a solution.

I've just merged in #3994, to be part of the next release, so that png-based favicon can be set directly from the settings in the same way as the app logo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants