Support the domain module

Created on 13 March 2023, over 1 year ago
Updated 25 May 2023, over 1 year ago

Problem/Motivation

Hello,

We are developing sites on the same code base, with multiple domains.
Details:
Drupal 9.5.4
PHP 8.1
Responsive Favicons 2.0.0
Domain 8.x-1.0-beta8

Domians are like these:
There is a main domian: example.com
There are more subdomains: subdomain1.example.com, subdomain2.example.com

Every site has a custom theme and custom favicon. Favicons generated by https://realfavicongenerator.net/
On responsive favicons admin page (/admin/config/user-interface/responsive_favicons) we enabled the domain configuration option. We set the "Path to responsive favicon files" folder for each domain, and save configuration.
Folder structure is:
For main domain: /sites/default/files/favicons
For subdomains: /sites/default/files/favicons/subdomian1, /sites/default/files/favicons/subdomian2

These are OK, when I select a domain from domian list, the folder settings is correct for all domains.

The problem is that, on all domains appears the same favicon. In HTML head section the favicons url are the same on every site.

Steps to reproduce

If I clear Drupal cache for example on main domain, then this favicons appear on all subdomians as well.
And if I clear Drupal cache on subdomain1, then the subdomain1 favicons appear on main domain, and on all subdomains as well.

✨ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡­πŸ‡ΊHungary bata.laci

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @bata.laci
  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand wiifm Wellington, NZ

    This is a little confusing. Are you doing a multi-site here (one site per domain)? Or using many domains attached to the one site (like using the https://www.drupal.org/project/domain β†’ module)?

    The first option should work. The second likely won't.

  • πŸ‡³πŸ‡ΏNew Zealand wiifm Wellington, NZ

    Changing metadata.

  • Status changed to Needs work over 1 year ago
  • First commit to issue fork.
  • πŸ‡¬πŸ‡§United Kingdom omahm Belfast

    I've done some initial work on this.
    The changes are the addition of a select element from which to choose your Domain. From that the upload path will have the Domain id appended to it to ensure there is a unique favicons directory for each Domain. Config is stored on a per Domain basis, this allows for variations on tags etc. Requests to favicons are rerouted based on the current Domain to each unique favicon directory.

    Still some work to do on this but any thoughts are welcome.

  • πŸ‡³πŸ‡ΏNew Zealand wiifm Wellington, NZ

    I do like the idea of a dropdown that only appears if the site is using the domain module. Perhaps there could be a form suffix (in the UI) added for the directory as well, to indicate the domain ID will be added, and there is no need craft a unique directory per domain.

    I assume the domain ID is not considered sensitive in any way.

  • πŸ‡¬πŸ‡§United Kingdom omahm Belfast

    Yeah, the Domain dropdown only appears if you check the 'Enable Domain support for favicons' (see the attached file) and that checkbox only appears if the Domain module is installed. I made that optional as I figured some multi-domain installs will share the same favicons across all domains.

    When you select a Domain, it appends the id onto the end of the 'Path to responsive favicon files' and that's the functionality that I'd really like some input into as it's only way I could get this to work without altering the module config schema.

    The attached Gif animation is how I'd like to present the required sub-dir options, you can use the domain id or if that is undesirable, then a custom dir. To provide this I'd need to add some additional entries into the module schema.

  • πŸ‡³πŸ‡ΏNew Zealand wiifm Wellington, NZ

    This seems rather complicated. I am unsure if the complexity is warranted either?

    Perhaps

    If the domain module is installed, then favicons will be looked for in the following directories (priority order):

    • Existing "path to responsive favicons" + domain ID folder
    • Existing "path to responsive favicons" + domain name folder
    • Fallback to "path to responsive favicons"

    The field description could be amended to make this clear.

    Then you don't need any additional drop downs, or AJAX or anything. Also saves a bunch of configuration.

    Thoughts?

  • πŸ‡¬πŸ‡§United Kingdom omahm Belfast

    The priority order is a good idea but I still think it'd be better to have the dropdown to select the Domain and the rational is that you'd need to log into each individual domain to save the config for each. Given that the dropdown will only appear if you have the Domain module installed I don't think it'll inconvenience the majority of users of this module.

  • πŸ‡³πŸ‡ΏNew Zealand wiifm Wellington, NZ

    Yeah OK, let's give it a go. Keen to review the patch, once you have one up.

  • πŸ‡ΊπŸ‡¦Ukraine stomusic Ukraine

    Look like works good for my situation. I've converted it to patch for possibility to easy apply now

Production build 0.71.5 2024