kiwix-tools icon indicating copy to clipboard operation
kiwix-tools copied to clipboard

kiwix-serve: favicon

Open nobicycle opened this issue 6 years ago • 16 comments

Hi, I would like kiwix-server to have a favicon in the browser 3109afed-2885-4821-befa-8a0d58ce2ea4 The black icon is what represents kiwix-serve at the moment. How to change it? (under Linux, if that is relevant)

nobicycle avatar Mar 04 '18 05:03 nobicycle

The favicon should come from the zim file. Which ZIM file do you tals about?

kelson42 avatar Mar 04 '18 06:03 kelson42

Hello kelson42, Both the main page http://127.0.0.1:8086 and wikipedia for schools have the icon mentioned above. 56abed01-e0a0-4f85-a484-9385889a7a26

nobicycle avatar Mar 05 '18 08:03 nobicycle

Confirmed using kiwix-serve built from c6ace1eafc06bbe52d596f0905e50dac47000a7a (Tue Mar 27 12:03:21 2018 +0200), browsing into all ZIMs (old directory style and new single ZIM file) have no favicon in Pale Moon 27.9. An example ZIM would be 'askubuntu.com_en_all_2017-10.zim'. On the library page the relevant sites have the correct icons associated with their boxes.

I'm guessing that since I'm browsing one domain name (which in the kiwix sense hosts multiple ZIMs), PM will request the favicon just once for the library page, which won't have one?

OmegaPhil avatar Apr 20 '18 17:04 OmegaPhil

https://github.com/kiwix/libkiwix/issues/471 secures we will have a favicon in kiwix-serve welcome page. But the favicon for each content should be managed in each ZIM. An here there is a lot to do as well. For the moment this is really not done properly in zimcheck and not in the scrapers either. We will have to improve that, but not sure exactly how. I will think about it in the next days.

kelson42 avatar Aug 01 '22 19:08 kelson42

Hello, I am a beginner and would like to work on this issue, please guide me how set up a development environment and check out this issue

aritroCoder avatar Sep 10 '22 09:09 aritroCoder

@veloman-yunkan Do you know how we could have a proper favicon for the browser with the iframe based viewer?

kelson42 avatar Sep 10 '22 10:09 kelson42

@veloman-yunkan Do you know how we could have a proper favicon for the browser with the iframe based viewer?

@kelson42 No. I don't think it's possible (at least, not easy) to have a content dependent favicon in iframe based viewer.

veloman-yunkan avatar Sep 21 '22 11:09 veloman-yunkan

But the favicon for each content should be managed in each ZIM. An here there is a lot to do as well. For the moment this is really not done properly in zimcheck and not in the scrapers either. We will have to improve that, but not sure exactly how. I will think about it in the next days.

Where is the icon at https://library.kiwix.org taken from?

JensKorte avatar Dec 18 '22 10:12 JensKorte

@JensKorte Honestly not sure, from commons.wikimedia.org probably. Any problem with it?

kelson42 avatar Dec 23 '22 11:12 kelson42

@JensKorte Honestly not sure, from commons.wikimedia.org probably. Any problem with it?

No, I like them.

But the favicon for each content should be managed in each ZIM. An here there is a lot to do as well. For the moment this is really not done properly in zimcheck and not in the scrapers either. We will have to improve that, but not sure exactly how. I will think about it in the next days.

I thought the icons at the library site could be used in the zim file.

JensKorte avatar Dec 23 '22 19:12 JensKorte

@veloman-yunkan Do you know how we could have a proper favicon for the browser with the iframe based viewer?

@kelson42 No. I don't think it's possible (at least, not easy) to have a content dependent favicon in iframe based viewer.

It's possible to retrieve the <iframe>'s icon and apply it to the main page, using JS. That's what zimit does. It's using a SW message but that's not required. Code can register a handler for the load event then query its DOM.

Where is the icon at https://library.kiwix.org/ taken from?

library.kiwix.org has a default icon (/favicon.ico) so whenever there's no semantic icon defined, it displays it.

rgaudin avatar Jan 18 '23 11:01 rgaudin

Where is the icon at https://library.kiwix.org/ taken from?

library.kiwix.org has a default icon (/favicon.ico) so whenever there's no semantic icon defined, it displays it.

Welcome page favicon(s) have been fixed recently, see https://github.com/kiwix/libkiwix/pull/805. That part works fine IMO. The problem is once we move to ZIM content.

kelson42 avatar Jan 18 '23 11:01 kelson42

Where is the icon at https://library.kiwix.org/ taken from?

library.kiwix.org has a default icon (/favicon.ico) so whenever there's no semantic icon defined, it displays it.

Welcome page favicon(s) have been fixed recently, see kiwix/libkiwix#805. That part works fine IMO. The problem is once we move to ZIM content.

As I wrote, favicon.ico is a default that browsers tries in case there's no better option. So kiwix-serve could simply respond to favicon.ico with its favicon and that would mean all pages (content or not) would have a favicon.

rgaudin avatar Jan 18 '23 11:01 rgaudin

As I wrote, favicon.ico is a default that browsers tries in case there's no better option. So kiwix-serve could simply respond to favicon.ico with its favicon and that would mean all pages (content or not) would have a favicon.

Not in favour of that. Would be better than what we have today, but is not what I expect.

kelson42 avatar Jan 18 '23 11:01 kelson42

I don't think you've expressed what you expect. This trick is super cheap and would bring some value.

Now if you want to have meaningful icons for content, because of how the player works it's easy to:

  • find out if the content has an icon
  • if it does, apply it to the page
  • if not, use the Illustration_48x48. It may not render great as this would be the browser resizing (cubic) but you'd have content-aware icons everywhere.
  • with the addition of aforementioned tweak, if anything goes wrong (missing icon or else), you'd still have the default, kiwix-serve icon.

None of this prevent the side effort of improving scrapers to make sure they provide favicons.

rgaudin avatar Jan 18 '23 11:01 rgaudin

@kelson42 No. I don't think it's possible (at least, not easy) to have a content dependent favicon in iframe based viewer.

It's possible to retrieve the <iframe>'s icon and apply it to the main page, using JS. That's what zimit does. It's using a SW message but that's not required. Code can register a handler for the load event then query its DOM.

@rgaudin Thanks! At the time I couldn't figure out a way of dynamically changing the favicon. I looked for standardized JS API and didn't find one. I completely neglected the possibility that it could be done by manipulating links in the <head> section.

veloman-yunkan avatar Jan 18 '23 14:01 veloman-yunkan