πŸ‡ͺπŸ‡ΈSpain @pau.sanz

Account created on 13 April 2022, about 2 years ago
  • Drupal Developer at SeidorΒ 
#

Recent comments

πŸ‡ͺπŸ‡ΈSpain pau.sanz

Hi everyone!

To alter the http protocol and instead set the https in the <link rel=β€˜canonical’...> element. I have made use of the following hook, hook_page_attachments_alter. I'm using Drupal version 10.2.6 and PHP 8.1.27.

function mytheme_page_attachments_alter(array &$attachments)
{
    if (!empty($attachments['#attached']['html_head'])) {
        foreach ($attachments['#attached']['html_head'] as $key => $link) {
            if (isset($link[0]['#attributes']['rel']) && $link[0]['#attributes']['rel'] === 'canonical') {
                $attachments['#attached']['html_head'][$key][0]['#attributes']['href'] = str_replace('http:', 'https:', $link[0]['#attributes']['href']);
            }
        }
    }
}

I hope I can be of help.

Thank you,

πŸ‡ͺπŸ‡ΈSpain pau.sanz

Hello again,

doing what you say, uninstalling the theme and reinstalling it from /admin/appearance in the 'Installed theme' section, and changing the administration theme momentarily to another installed theme to be able to press the 'uninstall' button that appears.

Then, in the 'Unistalled themes' section click the Install button, and set the Administration theme selector to 'Gin' and save the configuration by clicking the blue button below.

And now it works as expected with respect to the open issue.

Thank you very much for your help.

I hope it will be useful to other members of the community.

Regards.

πŸ‡ͺπŸ‡ΈSpain pau.sanz

Hi!

1.- Are those different Gin versions? The only version of Gin I use is 8.x-3.0-rc2. Also the configuration has been exported/imported via drush cim/cex.
2.- Different websites? Yes, in some installations it appears correctly, and in others it does not.
3.- Which Drupal version are you using? 9.5.4
4.- Did you install Gin like described on the project page? I installed it via Release section, composer require 'drupal/gin:^3.0@RC'
5.- Did you try uninstalling Gin and installing it again? No.
6.- Did you check for DB Updates? Yes, it is up to date.

Thank you!

Production build 0.69.0 2024