-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using icon code as text is not SEO-optimal #897
Comments
How about this? <i class="material-icons" data-icon="face"></i> .material-icons::before {
content: attr(data-icon);
} |
You can try Iconify instead of font. It uses similar syntax, but renders SVG instead of text. Best part is it loads only icons used on page and is available with many other icon sets (FontAwesome, Templarian's MDI, few emoji sets), not just material design icons so you can mix them all on same page without loading massive fonts. Add this instead of including font:
Then use code like this for icons:
See:
|
Using: ```html <i class="material-icons" data-icon="face"></i> ``` Thanks for [@denunv](google#897 (comment))
@cyberalien, In the Russian Federation, RosKomNadzor often blocks access to various IP addresses, trying to block access to Telegram. This can cause the inaccessibility of the destination server with icons, so it is extremely important to store them locally on the site. I think it would be correct to ask a question in the package repository: iconify/iconify#2 |
It's also possible to use the codepoints directly, e.g. as listed here: https://github.com/google/material-design-icons/blob/master/font/MaterialIcons-Regular.codepoints This would work around the ligature text problem. Also @denunv's solution is a good workaround. So I'm closing this issue because I believe it has been addressed. If not, feel free to reopen this issue or create a new one with more information! |
Search engines when indexing the site read all the content. Thus, the code of icons is perceived by them as part of the content, which is harmful to search engine promotion and can be considered by search engines as excessive filling of the site with keywords.
image 1
image 2
To solve this problem, use the
content
property of CSS style:Thus, both spellings of the code will be correct, but in the second case, the icon will not be taken into account by search engines as content:
The prefix
mi-
is chosen because the use of the icon code as classes may conflict with other styles used on the site, and the prefix gives the uniqueness of the class name.Since the additional styles file occupies 63.7 Kb of space, its connection is not mandatory for those who do not need it.
Example without additional styles:
Example with additional styles:
The text was updated successfully, but these errors were encountered: