-
Notifications
You must be signed in to change notification settings - Fork 32
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
Set favicon default url to /favicon.ico and allow to customize it #713
Conversation
Affected libs:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give more context ?
Who can't put the favicon in the assets ?
Note that it will break all actual configs.
This is unfortunately susceptible to break all existing favicons. I would rather look for a way to customize the favicon path, for instance on the docker image startup by rewriting parts of the HTML, like we do for adding preload links here: geonetwork-ui/tools/docker/docker-entrypoint.sh Lines 38 to 55 in f46b998
Outside of a docker usage, I feel like having a favicon point to the correct place should be easier. |
@jahow Is it ok, if we remove it like this ? |
I'm sorry for all the back and forth on this issue, but I think we shouldn't merge it like that. The way I see it currently, we should:
Otherwise we're losing functionality |
Revert "feat: allowing larger default integration for datahub's favicon and ME" This reverts commit 4f960614417ab2ba96f84ea482d107d88fe03f7a. feat: remove favicon in datafeeder and datahub
@jahow I've added the possibility to implement it from toml file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks better now, thanks! I've left some comments, please wait for 2.1 to be out before merging this.
I added a "breaking change" label so that we can remember that this new setting will be mandatory for people that don't have a favicon at their website's root. Please also update the PR title accordingly, so that it makes sense when it shows up in the changelog 🙂 thanks!
private setFavicon(faviconPath: string): void { | ||
const link = | ||
document.querySelector("link[rel*='icon']") || | ||
document.createElement('link') | ||
link['type'] = 'image/x-icon' | ||
link['rel'] = 'icon' | ||
link['href'] = faviconPath | ||
document.getElementsByTagName('head')[0].appendChild(link) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conf/default.toml
Outdated
@@ -34,6 +34,9 @@ proxy_path = "" | |||
# More information about the translation can be found in the docs (https://geonetwork.github.io/geonetwork-ui/main/docs/reference/i18n.html) | |||
# languages = ['en', 'fr', 'de'] | |||
|
|||
# Use it to set custom location for favicon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Use it to set custom location for favicon | |
# Use it to set custom location for the favicon; by default, the path `/favicon.ico` will be used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I think this setting should go in the "theme" section
const link = | ||
document.querySelector("link[rel*='icon']") || | ||
document.createElement('link') | ||
link['type'] = 'image/x-icon' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will make the favicon fail if it is in another format, e.g. PNG; to remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good thanks!
The default favicon points to
/assets/favicon.ico
. As favicon is often provided in root, it's useful to have it there.