A lot of Joomla based sites want to use their own favicons but there is no easy way to change the existing triplet apart from editing the index.php file. I believe that is a problem because the change is overwritten if Cassiopeia gets updated. Can the favicon file names be made configurable in the same way that the logo is configurable?
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
You can create a copy of the Cassiopeia template and modify the index.php of that and use that copied template as default for the frontend. The override check should be able to show you if there are things to be changed in the copy after a core update which has changes in Cassiopeia.
That's a suggestion but probably we should not promote this, once the UI for child templates is ready the whole process will be way more approachable.
For this actually, you don't need to fork the template, just create the svg/ico images in the templates/cassiopeia/images
and presto you have custom favicons. This can be done using the editing part of the template only requirement is that the favicons should be named:
joomla-favicon.svg
joomla-favicon-pinned.svg
favicon.ico
The first 2 needs to be svg
but there are plenty of online tools to convert a bitmap to svg (eg https://vectormagic.com). The favicon.ico
can also be created using online tools (eg https://cloudconvert.com/svg-to-ico).
Thanks everyone. I don't think that it's a good approach to add some configuration option to the template to change the favicon for a website but that's just my opinion. It should be easy to create a plugin that unsets the existing "<link ...>" statements and then use the addFavIcon() method to replace whatever is normally generated with something else that the site owner may choose to use instead.
Yes, I am aware that you can replace the existing three files in templates/cassiopeia/images
and I am aware of various tools one can use to create SVGs. The issue is not about creating files and placing them in that folder. The issue is about what happens when the site owner uses the J! Update Component. Aren't these files replaced as part of the update procedure? That would mean that, every time the site owner updates the template (e.g. when updating J!) these three files need to be replaced again, yes?
At this time—the early days of J! 4—it's probably not advisable to clone existing templates because the clones may get out of step with the original (and changing) version.
From my viewpoint, I would prefer to de-couple the current method (i.e. relying on files that are located in a specific folder) from the template and use a system plugin instead. The discussion on the J! forum is an example of what I would like to do: see https://forum.joomla.org/viewtopic.php?f=808&t=987328
The issue is about what happens when the site owner uses the J! Update Component. Aren't these files replaced as part of the update procedure?
A 2 second check would have shown you that they wont be.
Thanks, Brian: my 2-second check was based on https://forum.joomla.org/viewtopic.php?f=808&t=987328#p3636581 where another person says that these files were replaced. I suppose I could perform a 2-minute check: run the Joomla Update component with "restore core CMS files" as the option and see what happens. Give me a few minutes to run that and I'll let you know. :)
I'm working as fast as I can, Brian
you just have to look at the files
OK. The first test was to add one new image to the folder templates/cassiopeia/images
with the name favicon.ico, detonate the aggressive browser cache and, sure enough, the raw HTML shows the following:
<link href="/media/system/images/joomla-favicon.svg" rel="icon" type="image/svg+xml">
<link href="/templates/cassiopeia/images/favicon.ico" rel="alternate icon" type="image/vnd.microsoft.icon">
<link href="/media/system/images/joomla-favicon-pinned.svg" rel="mask-icon" color="#000">
Which is lovely! Except that my browser prefers to display the SVG image instead of the ICO image. How do you "unset" (for a better way of describing things) the SVG links? Do you need to convert the bitmap to SVG for every favicon you want to use and place the SVG versions in the template/images folder as well?
Getting back the the original "2-second test", you're absolutely right, Brian. Running the J! Update component does not delete or replace any user-uploaded files placed in templates/cassiopeia/images
. I would not have expected the update process to affect user-uploaded files placed in that directory. However, folklore is a dangerous thing (especially when one is navigating through new territory) and if one person says something is false (contrary to one's experience) then it makes one doubt one's beliefs. So, it turns out that https://forum.joomla.org/viewtopic.php?f=808&t=987328#p3636581 was "fake news".
It still doesn't address my "wish" to be able to use a plugin to define favicons on-the-fly as I have been able to do for a few years (and I need to experiment more) and it doesn't answer how to unset
existing links (that refer to SVGs) but, with some help we may get there. :)
not "fake news" just "wrong"
just as the original post here is wrong
I was being kind, Brian, when I wrote "fake news". Yes, the advice posted on the forum was incorrect and it should have been corrected but I've been locked-out from the forum for the past month and I only became engaged with this matter in the past two-to-four days. I also agree (and I stated it before) that I don't think it's a good idea to add configuration options to Cassiopeia (or Atum, for that matter) but we do need some gentle education about the options that are available. I also reaffirm my opinion that cloning these templates at this time is not really a desirable workaround.
So just take the paragraph that Dimitris wrote and add it to the documentation site.
I really do have my hands full at the moment, Brian. I have a to-do list for today that will keep me occupied for several hours. I'm taking a break from webcraft-related activities for a while. Good idea, though, to fix the documentation. :)
please close
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-11-09 18:27:40 |
Closed_By | ⇒ | richard67 |
Closing as stated in the discussion above. Feel free to re-open if you think this is wrong.
You can create a copy of the Cassiopeia template and modify the index.php of that and use that copied template as default for the frontend. The override check should be able to show you if there are things to be changed in the copy after a core update which has changes in Cassiopeia.
The override check wont do anything in this scenario
just create the svg/ico images in the
templates/cassiopeia/images
and presto you have custom favicons. This can be done using the editing part of the template only requirement is that the favicons should be named:
If only it was that easy. By default neither svg nor ico files can be uploaded using the editor
If only it was that easy. By default neither svg nor ico files can be uploaded using the editor
Also you can't create .min.css
or .min.js
and countless more limitations I've discovered as I was patching com_templates. The editor part of com_templates is really bad (no A11y, awful UX, etc) but I was asked to not introduce more B/C breaks than the absolute minimum to get the new functionality (reasonable decision as 4.1 is not a major version).
I might have another solution...
Well, if I shall re-open this issue in the mean time, let me know and I do so.
Kd
You can create a copy of the Cassiopeia template and modify the index.php of that and use that copied template as default for the frontend. The override check should be able to show you if there are things to be changed in the copy after a core update which has changes in Cassiopeia.