How to add shortcode to blogspot?

Is it possible to create short codes in a blogger? Sort of:

[item]contents[/item] 

or

 [img class='someClass']yourimagelink[/img] 
+6
source share
2 answers

Short answer: depends

  • for parts that complement the content features present on the page, or if you don’t care about SEO and are sure that [img src=a class=b] better than <img src="a" class="b"> , yes maybe see the Blogger shortcode plugin or create your own shortcode.js .
  • for important pieces of content that need to be indexed no, this is not possible .

If you are wondering why, here is a long answer:

To access a web page, you have servers and their languages pre - [browser-download] - processing (PHP, ASP, Ruby, Perl ..) and clients (browsers) with their languages ​​(Java-, Type- and ActionScript). Search engines rely on the code sent by the server, obviously, because only a person needs a browser to request a page. As with many free hosts (freewebs, wix, ..), you do not have direct access to the server code in Blogger, but you can change the template like XHTML with custom tags like Blogger <b:include> , which scenes may cause a call to <?php include() ?> or similar. This leaves us with client scripts as an alternative.

While the shortcode blog plugin mimics Wordpress shortcodes, it is built into Javascript and therefore is not used in [traditional] search engines.

Reportedly, Google could access Javascript content using the Chrome browser as an extension to its search engine (so it is rumored to be). However, the results page shows mixed results. This is not because you can understand some words in a song that you can say with confidence about it : even if search engines index it, they will not necessarily do it right. The question also arises: if 90% of visitors visit a website from another browser, how will Google get enough data to understand your dynamic content?

If you look at the Shortcode Blogger plugin , you will also notice that it includes basic CSS-style elements, and the third is party, which you can usually copy-paste-paste-code from your page into an HTML presentation. And as a personal note, I would say: why use short codes such as [image class=x] when this is exactly the same as doing <img class="x"> ?

Conclusion: Do not use short codes and stay on Blogger or receive hosting using CMS, which initially supports short codes, such as Wordpress.

+1
source

My Blogger tricks have recently created a bunch of shortcodes for bloggers. You can check them out here .

To create your own shortcodes

You can create shortcodes for your site using shortcode.js. Here's how you create the shortcode [item]contents[/item] . 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] 
0
source

Source: https://habr.com/ru/post/983014/


All Articles