0

Favicon of my site working correctly within my site. but externally, when I see my site in google search result, Favicon has not been registered.

when I check link tag of favicon in head section of html, url path of href includes static content version number.

link rel="icon" type="image/x-icon" href="https://example.com/static/versionxxxxxxx/frontend.../favicon.ico"

this version number change each time when static content deploy executed.

I am guessing the constant change of href prevent registering favicon in google.

I know Magento can show off the version number by the configuration. But whole static contents version will turn off, I do not like to turn off this feature.

Does someone have good advice to fix this issue?

Thanks

2 Answers 2

0

You need to run the below query in your magento database.

insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);

Then run the below commands

php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
php bin/magento cache:clean

Your version number will be removed from the static urls.

1
  • Thank you for your answer. but I know above solution. I would like to keep alive the versioning feature. Is there a way to remove version number only for favicon href?
    – user16342
    Commented Oct 25, 2023 at 9:49
0

Use the Magento admin console feature, CONTENT > Design > Configuration.

Edit the Global Default Theme > Other Settings > HTML Head > Upload the Favicon Icon.

And select "Use Default Value" in the other Website/Store level configuration for this field, then save the Configuration.

And when you browse you website, you can see the following contents in head section.

<link rel="icon" type="image/x-icon" href="https://magento2.docker/media/favicon/default/favicon.png">
<link rel="shortcut icon" type="image/x-icon" href="https://magento2.docker/media/favicon/default/favicon.png">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.