Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add shortcode to blogspot?

Is it possible to create shortcodes in blogger? Something like:

[item]contents[/item] 

or

[img class='someClass']yourimagelink[/img]
like image 749
wj R. Avatar asked Feb 26 '15 03:02

wj R.


People also ask

How do you add a shortcode in HTML?

Press the brackets icon to display the shortcode. Then, copy the shortcode, as you'll need it later. Go to Appearance -> Customize, to go to the Customizer and insert the custom HTML in the page you want. Create a new section that will be dedicated to the custom HTML you want to insert in the page.


1 Answers

The short answer is: it depends

  • for pieces that augment features of content present on the page, or if you don't care about SEO and are convinced that [img src=a class=b] is better than <img src="a" class="b">, yes, it's possible eg see Blogger shortcode plugin or create your own with shortcode.js.
  • for important pieces of content that should be indexed no, it's not possible.

If you're interested in why, here's the long answer:

To access a webpage, you have servers and their pre-[browser-load]-processing languages (PHP, ASP, Ruby, Perl..), and clients (browsers) with their languages (Java-, Type-, & Actionscript). Search engines rely on code sent by the server evidently because only humans need a browser to query a page. As with many free hosts (freewebs, wix, ..), you do not have direct access to the server-side code in Blogger, but you can modify the XHTML-like template with custom tags like Blogger's <b:include>, which behind the scenes probably makes a call to <?php include() ?> or similar. This leaves us client-side scripting as only alternative.

While the shortcode blogger plugin mimics the Wordpress shortcodes, it is built in Javascript and therefore of no use to [traditional] search engines.

Reportedly, Google could access some Javascript contents by using the Chrome browser as an extension of its search engine (so it is rumored). However, the page linked to shows mixed success results. It's not because you can understand some words in a song that you can necessarily make sense of it: even if search engines index it, they won't necessarily do it correctly. It also begs the question: if 90% of your visitors access the website from another browser, how will Google get enough data to make sense of your dynamic content?

If you have a look at the Blogger shortcode plugin, you will also notice that what it enables are basic CSS-styled elements, and third-party embeds, which you can usually copy-paste an embed-code from to your page in HTML view. And as a personal note, I would say: why use shortcodes like [image class=x] when that's exactly the same as doing <img class="x">?

Conclusion: don't use shortcodes and stay on Blogger, or get hosting with a CMS that natively supports shortcodes like Wordpress.

like image 70
webketje Avatar answered Oct 26 '22 18:10

webketje