Is it possible to create shortcodes in blogger? Something like:
[item]contents[/item]
or
[img class='someClass']yourimagelink[/img]
Is it possible to create shortcodes in blogger? Something like:
[item]contents[/item]
or
[img class='someClass']yourimagelink[/img]
The short answer is: it depends
[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.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.
My Blogger Tricks has recently created a bunch of shortcodes for blogger. You can check them out here.
To create your own shortcodes
You can create shortcodes for your site with shortcode.js
Here is how you will create an [item]contents[/item]
shortcode. Run the code to see it in action.
new Shortcode(document.querySelector('body'), {
item: function(done) {
return this.contents;
}
});
<script src="https://rawgit.com/nicinabox/shortcode.js/master/src/Shortcode.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
[item]Sample text[item]
© 2022 - 2024 — McMap. All rights reserved.