Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Umami theme does not have a favicon. Let's create one for it.
Previuosly discussed at https://github.com/lauriii/umami/issues/109
Comment | File | Size | Author |
---|---|---|---|
#40 | 2938190-39.png | 16.15 KB | Sutharsan |
#39 | favicon_screenshot.png | 283.21 KB | Eli-T |
#36 | umami_favicon-2938190-36.patch | 5.58 KB | Gvert |
#31 | IMG_0981.PNG | 159.38 KB | John Cook |
#31 | IMG_0980.PNG | 20.49 KB | John Cook |
Comments
Comment #2
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedComment #3
Adam_MoulsdaleI created a favicon based on the first letter of the logo.
Does this look okay?
Comment #4
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedI like this generally as a favicon design. Moving the U nearer the centre would improve it a bit.
Comment #5
Adam_MoulsdaleI have moved it more central. Tried to get it as close as I can :)
Comment #6
sastha CreditAttribution: sastha as a volunteer commentedComment #7
ckrina+100 to #5 proposal!
Comment #8
sastha CreditAttribution: sastha as a volunteer commentedFavicon looks good. If possible, please attach a version with ".ico" extension also
Comment #9
sastha CreditAttribution: sastha as a volunteer commentedComment #10
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedGood catch! Can someone else chime in on what the current cross-browser file format practice is here? Do we need one of those .ico formats with 16px and 32px variants embedded?
Comment #11
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedHere's a slightly different approach which gives us responsive favicons (via a manifest.json file), so users will get a decent sized favicon based on what device they are on - iPad, Android tablet, android phone, etc
It also has fallbacks for favicon.ico in 16x16 and 32x32
Comment #12
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedHere's one with better quality favicons, the last were generated from a low resolution png, these are from an SVG source.
Comment #13
smazIf we're going to abstract the processing out (to favicons.php), we should do that in an OOP way. Working on that now.
Comment #14
smazOk, I've re-worked the patch from @markconroy to use OOP.
I've also added a test - 2938190-14-add-favicons--test-only.patch should fail, then
2938190-14-add-favicons.patch should pass.
I had to move the favicon.ico to the root of the theme folder, so that it would be automatically picked up & set to the fallback 'shortcut icon'. I tried to set this using an umami.theme.settings.yml file, but the following failed tests due to a . in the config value:
Comment #16
JayKandariHi here's my review.
1. Patch applies cleanly.
2.
Requires a new line at EOF.
3.
Another new line at EOF required.
4. favicon.ico appears correctly in the browser.
5. On bookmarking an URL, the 144x144 bookmarked icon is shown.
6. Tests passing in local successfully.
7. Tested on chrome on iPhone 6, Android. Also tested on Edge 16 on Windows 10
8. Markup has correct link elements.
With above nitpicks, I'm good to do RTBC!!
great work guys. :) This looks awesome on the devices I tested on. It might require testing on more devices. :)
so far LGTM.
Thanks!!
Comment #17
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedhelping by removing nit picks by @JayKandari :-)
Comment #18
larowlannice!
Given we control the theme here - any reason why we don't just hard-code this in markup in html.twig.html?
hook_page_attachments_alter feels like a hack
Comment #19
smazMight have borrowed that idea from core - DefaultMetatagsTest... :)
#2, hardcoding - not sure - @markconroy?
Comment #20
markconroy CreditAttribution: markconroy at Annertech commentedI have no problem with them being hard coded into html.html.twig.
In my starter theme in work, I use the hook_page_attachments_alter, but not exactly sure why to be honest.
@smaz, can you do that? I'm a little stuck for time today.
Comment #21
smazMy only argument for doing this via preprocessing is that it means we don't have to bring in a copy of html.html.twig & maintain it with any changes made to classy (the base theme we use). I can't imagine that being a problem often, if at all though. We're also not really modifying the HTML structure as such.
Would be nice to use hook_page_attachments instead of hook_page_attachments_alter if we do stick with this way, but seems like we can only use _alter.
I don't mind which way it's done either.
Comment #22
markconroy CreditAttribution: markconroy at Annertech commentedI don't have any preference for either approach, though what @smaz says above about not needing to maintain another template does make sense.
I'm going to vote for leave it as is, unless @larowlan or some other maintainer/committer is dead set against it.
Comment #23
JayKandariI'm in favour of "hook_page_attachments_alter" rather than hardcode it on new html.html.twig template. Although it is less likely to change, still we'll be maintaining a new template file. I may be missing something, please correct me.
Marking this RTBC as of now, happy to see others views as well !!
Thanks :)
Comment #24
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedInstead of thinking of what *we* have to maintain, Umami should be about showing evaluators how *they* can maintain a theme. Using the hook (a) shows off a Drupal alter hook with a render array, and (b) shows that you don't have to override every Twig template in your theme. Umami already has custom templates for page, node, and lots of blocks - nice to leave one of the major ones alone.
Comment #25
xjmCan we also get the asset in the issue here, or better yet a screenshot? I'm assuming it is not actually the Montpellier logo? (Which was an awesome camp but let's not over-borrow their brand.) :)Sorry they are totally here; I just missed them because they were not embedded. I'll update the IS.Also @larowlan's review from #18 hasn't really been addressed.
Comment #26
xjmComment #27
markconroy CreditAttribution: markconroy at Annertech commented@xjm,
I think it has been addressed in that some of us don't mind either approach, Smaz suggested he'd prefer to leave it, and Andrew gave a very good reason why it should stay as is.
Unless there is a very strong argument against the current approach ("feels hacky" isn't that strong an argument), I'd say leave it as is.
Comment #28
xjmWell I agree with @larowlan; we should really avoid using that hook and it seems way off for a theme to use it for its own assets.
At a minimum, it should be refactored so that there is a
$icon_base
or whatever array that contains the defaults that are used for most of the entries, and have the individual changes added in when it is added to the array. (Afor
loop might also come in handy.)Tagging for frontend framework manager review hopefully for some wisdom and guidance. :)
Comment #29
lauriiiComment #30
lauriiiSorry, I think this is actually something that needs a framework manager review.
Comment #31
John Cook CreditAttribution: John Cook at Creode commented@xjm; I don't think changing the multiple
$html_head[] = ...
s to be afor
loop would be any help, as we would still need an array to store the icons – we'd just be copying one array to another.As a visual test, here's the favicon in Chrome on MacOS:
In the tab –
In the bookmark menu –
And IOS with Safari:
In the bookmark screen –
On the 'home' screen –
There's the issue that when it's put on the home screen, the label defaults to 'App'. This can be changed in the manifest.json file.
It would be nice to get this in 8.6 as it adds a little more pollish to the site.
Comment #32
John Cook CreditAttribution: John Cook at Creode commentedComment #34
Eli-THave discussed at length with @kjay.
It would be an incremental improvement to include the 32x32 icon uploaded in #5. Therefore we should restrict this issue to achieving that and move talk of manifests and responsive favicons to a follow up issue if required.
Note as core does not support this without custom code, it does not seem appropriate to implement this in Umami, so the follow up might not be required. Let's not debate that here though - if you want to advocate for the approaches discussed from #11 onwards, please create a new issue and link here.
Remaining work is to convert the favicon in #5 to .ico and include it in the theme. Tagging Novice and suggest that's achievable at Drupal Europe.
Comment #35
robindh CreditAttribution: robindh at Anvil commentedGvert and I will be working on this at DrupalEurope.
Comment #36
Gvert CreditAttribution: Gvert at Anvil commentedBased on comment #34, i've created a patch, which adds the favicon.
Comment #37
Gvert CreditAttribution: Gvert at Anvil commentedComment #38
Sutharsan CreditAttribution: Sutharsan at LimoenGroen commentedI'm at DrupalEurope reviewing the patch.
Comment #39
Eli-TPatch looks good.
Tested on simplytest.me and the favicon is automatically picked up and looks good.
Marking RTBC
Comment #40
Sutharsan CreditAttribution: Sutharsan at LimoenGroen commentedPatch applies cleanly. Add the file core/profiles/demo_umami/themes/umami/favicon.ico File looks the same as in issue summary.
Favicon shows up in FF (screenshot below), Chrome, Safari on OSX.
File info, to document the image size:
Comment #42
lauriiiWe could use a follow-up for #34. Feel free to move back to RTBC once that has been done.
Comment #43
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedRelated to the follow-up for #34, there is #2698127: Extend site information page to generate a manifest.json file.
That issue doesn't aim to put icons in the manifest, but it does introduce a hook which can do that. I suggest framing our follow-up as a demo of the core manifest feature, and only do it if that issue lands.
Comment #44
Eli-TMoving back to RTBC. #34 should not have a follow up until Drupal can implement this in core. I don't think we should raise pre-emptive follow ups in Umami for things core may or may not do.
Comment #45
markconroy CreditAttribution: markconroy at Annertech commented+1 for what Eli-t says in 44
Comment #46
Gábor HojtsyComment #49
Gábor HojtsySuperb, a simple favicon is still better than no favicon :) I think it would still be nice to add an issue to support multiple favicons and there is likely one somewhere already.