IT Blog

  • Blog
  • Technology
    • Technology
    • Architecture
    • CMS
    • CRM
    • Web
    • DotNET
    • Python
    • Database
    • BI
    • Program Language
  • Users
    • Login
    • Register
    • Forgot Password?
  • ENEN
    • 中文中文
    • ENEN
SEO
Plugin

Add ALT attribute to Social Media Icon

AlT attribute for an image is helpful factor for SEO. But the plugin "Social Media Share Buttons" by Sygnoos is not adding alt attribute for all social images. The following is my approach to add alt attribute to the social images. For this reason, Bing search console is always give a warning message and refuse to index the site. 1. Find possible keyword using browser tool. 2. locate keyword using Visual Studio find feature. Location: /wp-content/plugins/social-media-builder/js/addNewSection/SGMBWidget.js 3. add alt attribute to the images with jQuery. 4. result: Additionary, to set all images ALT value where alt is missing, using this script: Set alt value to image file name where alt is missing $('img').each(function(i,e){ if($(e).attr('alt')=='') $(e).attr('alt', $(e).attr('src').replace(/^.*(\\|\/|\:)/, '').replace(/\.[^/.]+$/,'')); }); How to get this script? Explained below. //show all img src $('img').each(function(i,e){console.log($(e).attr('src'));}); //show all img alt $('img').each(function(i,e){console.log($(e).attr('alt'));}); //get file name from path filepath.replace(/^.*(\\|\/|\:)/, ''); //get file name without extension from file name filename.replace(/\.[^/.]+$/,''); //show all img file name without extension $('img').each(function(i,e){console.log($(e).attr('src').replace(/^.*(\\|\/|\:)/, '').replace(/\.[^/.]+$/,''));}); //set alt value to image file name where alt is missing $('img').each(function(i,e){if($(e).attr('alt')=='') $(e).attr('alt', $(e).attr('src').replace(/^.*(\\|\/|\:)/, '').replace(/\.[^/.]+$/,''));});    999 total views

2021-12-03 0 Comments 337 Views 5 Like IT Team Read more
Chinese (Simplified) Chinese (Simplified) Chinese (Traditional) Chinese (Traditional) English English French French German German Japanese Japanese Korean Korean Russian Russian
Newest Hotspots Random
Newest Hotspots Random
Rich editor not working Making web page scroll down automatically Getting data from Dapper result All Unicode Chars How to keep and display contact form 7 data Common Regular Expressions
Set up DKIM to prevent email spoofing on GSuite Temporary tables lifetime Crawling images from web with PHP WordPress cron job best practice WordPress Featured Image in database Passing parameters to event handler, setTimeout
Categories
  • Architecture
  • BI
  • C#
  • CSS
  • Database
  • DotNET
  • Hosting
  • HTML
  • JavaScript
  • PHP
  • Program Language
  • Python
  • Security
  • SEO
  • Technology
  • Web
  • Wordpress

COPYRIGHT © 2021 Hostlike IT Blog. All rights reserved.

This site is supported by Hostlike.com