User tests: Successful: Unsuccessful:
Pull Request for Issue # .
There are 2 things done in this PR:
Why?
The code used to live in the Document function _loadTemplate
and would always ran when parsing the template index (or whatever was instructed to use as index). The proposed change here moves the responsibility to the MetasRenderer because the code spits out a head link and all other headlinks are handled by this renderer. Also the code will never run if a favicon has already been set, meaning it's more efficient (and we like efficiency, right?)!
Why?
Sort answer: because it's 2020. Longer version:
According to https://caniuse.com/link-icon-svg 89.21% of the Browsers already support SVG favicons. Also there's a fallback so in our case it's always 100%.
SVG icons are vector based, meaning they will always look sharp!
SVG icons support light/dark themes
Usually they're lighter than the .ico
templates/cassiopeia/index.php
and delete or mute these lines (40-44)// Browsers support SVG favicons
$this->addHeadLink(HTMLHelper::image('joomla-favicon.svg', '', [], true, 1),'icon', 'rel', ['type' => 'image/svg+xml']);
$this->addHeadLink(HTMLHelper::image('favicon.ico', '', [], true, 1), 'alternate icon', 'rel', ['type' => 'image/vnd.microsoft.icon']);
$this->addHeadLink(HTMLHelper::image('joomla-favicon-pinned.svg', '', [], true, 1),'mask-icon', 'rel', ['color' => '#000']);
templates/cassiopeia/images/favicon.ico
to templates/cassiopeia/favicon.ico
and check that you get an icon in the front-pageDark Mode
Light Mode
Safari Pin tab icon
IDK but there are some great articles out there for the svg favicons, eg https://css-tricks.com/svg-favicons-and-all-the-fun-things-we-can-do-with-them/
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Templates (admin) Libraries Front End Templates (site) |
Labels |
Added:
?
|
Category | Administration Templates (admin) Libraries Front End Templates (site) | ⇒ | Administration Templates (admin) Repository NPM Change Libraries Front End Templates (site) |
Labels |
Added:
NPM Resource Changed
|
Expected result?
Yes
there is a color svg icon available for Joomla logo
I know but this PR is providing the base functional code for favicons that are adapting depending on the os display settings (dark or light theme) so the coloured svg is irrelevant
I am confused by the testing instructions. My Cssiopeia index.php does not have the lines to be muted/deleted. I have pulled the latest origin from github into my clone and checked the origin does not have those lines either. I my be doing something wrong but I can't think what.
I have pulled the latest origin from github into my clone and checked the origin does not have those lines either.
Probably you need to download the test package from the GitHub PR's page or https://ci.joomla.org/artifacts/joomla/joomla-cms/4.0-dev/31436/downloads/37672/
Sorry - I am a complete idiot! Looking at my previous install for testing and my current install in Eclipse.
Sorry - I am a complete idiot! Looking at my previous install for testing and my current install in Eclipse.
Commenting out the given lines and copying favicon.ico results in no favicon. I see this in the source:
<link href="/joomla-cms-4templates/cassiopeia/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
Missing / before templates.
Commenting out the given lines and copying favicon.ico results in no favico
You are right, the logic wasn't right. Please try again, also try to repeat the same muting in the administrator/atum/login.php copying again the favicon.ico from the images subfolder to the atum root (assuming you are logged out of the admin area).
Thanks for testing
@SniperSister Any idea why the analysis4x
step in drone systematically fails for this PR? Maybe it doesn't like the SVG?
I have tested this item
I checked Cassiopeia, Atum and Atum login. It was handy to have favicon.ico in colour and favicon.svg in mono - easy to see the change.
I have tested this item
Nice PR
Could you please use HTMLHelper::_('image', ....)
(instead of HTMLHelper::image
to enable the overriding of the method?
Labels |
Added:
?
|
The last commit was not a functional change, so previous tests are still valid, and that last change is good for me by code review.
I'll restore the test results and set RTC.
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-11-24 12:52:56 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
Removed: ? |
Nice improvement - thanks!
@dgrammatiko PLEASE write up documentation on this. You've got 4 separate files ( why not a param? ) with nothing explaining how/why 3 favicons, what the values do and their alternatives.
// Browsers support SVG favicons
$this->addHeadLink(HTMLHelper::_('image', 'joomla-favicon.svg', '', [], true, 1), 'icon', 'rel', ['type' => 'image/svg+xml']);
$this->addHeadLink(HTMLHelper::_('image', 'favicon.ico', '', [], true, 1), 'alternate icon', 'rel', ['type' => 'image/vnd.microsoft.icon']);
$this->addHeadLink(HTMLHelper::_('image', 'joomla-favicon-pinned.svg', '', [], true, 1), 'mask-icon', 'rel', ['color' => '#000']);
All the documentation you need is here: https://css-tricks.com/svg-favicons-and-all-the-fun-things-we-can-do-with-them/
I miss the colour favicon :(
I miss the colour favicon :(
Just switch the svg inner code, but then the dark/light css will have zero effect (btw the code is the same as the rest logos it's just missing the hardcoded fill attributes).
Honestly, I think is way more valuable to have a modern base to build upon rather than having something that we were just used to. Things evolve and dark/light themes are kinda expected for any modern website nowadays...
So adding the joomla colors to the svg image should fix it? I mean our logo as colors and I miss them too ;-)
So adding the joomla colors to the svg image should fix it? I mean our logo as colors and I miss them too ;-)
I think both of you are missing the point here. The codebase as is right now it's a very solid foundation for favicons that adapt according to the user's OS preferences for dark or light theme. If you hardcode the colours then this whole concept goes away and basically, imo, it's a step backward. The code is there to help users/template authors to achieve great results with less effort, not to present the Joomla logo with colour accuracy
I think you miss the point, the Joomla logo has colors and people creating websites shouldn't use the joomla logo. If we ship a non colored version I'm fine with it but the default logo should have colors.
the default logo should have colors.
Problem is that these two cannot happen simultaneously. I made the call for best practices over colour accuracy of the logo (explained it my reasoning in the comment above).
Of course you can revert that if you think that the colours of the Joomla tiny logo on the favicon is way more important than some code that is self explaining how to be replicated to have adaptive favicon for any logo. As I said you can restore the fill attribute in the elements...
All the documentation you need is here: https://css-tricks.com/svg-favicons-and-all-the-fun-things-we-can-do-with-them/
says absolutely nothing about how joomla is creating the favicon nor what the params mean/do. Please don't be lazy.