Adding Shortcodes to Your Blogspot - A Simple Guide

Can custom shortcodes be created in Blogger? For example:

[item]contents[/item] 

or

[img class='someClass']yourimagelink[/img]

Answer №1

Simply put, the answer is: it varies

  • If you're looking to enhance content already on the page, or if SEO isn't a concern and you prefer using [img src=a class=b] over <img src="a" class="b">, then yes, it can be done. Check out examples like the Blogger shortcode plugin or create your own with shortcode.js.
  • However, for important indexed content, no, it's not possible.

For a more detailed explanation:

When accessing a webpage, servers use pre-browser-load processing languages (PHP, ASP, Ruby, Perl..) while clients (browsers) use their own languages (Java-, Type-, & Actionscript). Search engines rely on server-side code since only humans need a browser to view a page. In Blogger, you can modify XHTML-like templates but cannot directly access server-side code. This limits options to client-side scripting.

While the shortcode blogger plugin imitates Wordpress shortcodes, it is Javascript-based and therefore not useful for traditional search engines.

Although there are reports of Google possibly accessing Javascript content through Chrome, results have been mixed. Just because content may be indexed does not guarantee accurate interpretation by search engines. Consider also the challenge of understanding dynamic content from visitors using various browsers.

Examining the Blogger shortcode plugin, you'll see it mainly enables basic CSS-styled elements and third-party embeds, which can typically be added via HTML view. In my opinion, why complicate things with shortcodes like [image class=x] when <img class="x"> serves the same purpose?

In summary: Avoid shortcodes in Blogger unless using a CMS like Wordpress that supports them natively.

Answer №2

Recently, My Blogger Tricks unveiled a new set of custom shortcodes specifically designed for bloggers. Interested individuals can find more information by visiting this link.

If you want to create your own customized shortcodes

You can easily generate shortcodes for your website using shortcode.js. Follow the steps below to create an [item]contents[/item] shortcode and view 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]

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having difficulty inserting an image with style="background-image:url(' ')" in Rails from the database

Hi everyone! I am new to both Rails and Stack Overflow, and I would really appreciate it if someone could guide me here. I am currently working on a test site that resembles a personal blog. It's mainly for showcasing one user's portfolio. In t ...

` Time Running Out: A Classy Countdown Timer`

Here are the lines of code I have included in my webpage - example/demo. HTML: <p class="countdown-timer">10:00</p> <p class="countdown-timer">10:00</p> JavaScript: I am looking for guidance as a beginner in JavaScript and JQue ...

extract data from an input field that is located outside the current page of a datatable

I am currently working with VB.Net, MVC, Razor, JavaScript, and jQuery while utilizing the Datatables plugin. One of my tasks involves rendering a table that consists of text boxes where users can input values to be submitted to the database. While this s ...

"Troubleshooting: Why isn't my jQuery AJAX POST request successfully sending data to

Here is the jQuery code snippet that I am currently working with: $("#dropbin").droppable( { accept: '#dragme', hoverClass: "drag-enter", drop: function(event) { var noteid = "<?=isset($_POST['noteid']) ? ...

Confirm the drag-and-drop functionality for customers by utilizing the accept feature

Is it possible to customize my draggable & droppable module with these classes? stackDrop1 (Kitchen) stackDrop2 (Road) stackDrop3 (Completed) https://i.sstatic.net/vxFCx.jpg If the Customer George is in the Road class, the Kitchen class will not accept ...

Slide up to 100 pixels above the anchor using jQuery

I am looking for a solution where the anchor position is 100px below the top of the page instead of jumping to the very top. I prefer not to have any animations, and I want to avoid the anchor jumping twice. I am seeking a universal fix for this issue. I ...

Perform the trigger function when scrolling for the first time

I am working on a project where I need to trigger a click event when the user scrolls down 700px. This is the code I have so far: $(window).scroll(function(){ playVideo(); }); function playVideo() { var wScroll = $(window).scrollTop(); if (wS ...

Avoid triggering tooltips on child elements within Bootstrap

Imagine having the following HTML tags: <ul data-toggle="tooltip" data-title="hello world"> <li data-toggle="tooltip" data-title="content 1">content 1</li> <li data-toggle="tooltip" data-title="content 2">content 2</li&g ...

What is the process to include a CSS file in PHP?

Can anyone guide me on how to include my CSS file in PHP? require('config.php'); $cssFile = "style.css"; echo "<link rel='stylesheet' href='/books/style.css'>"; What is the process of adding CSS to a PHP appl ...

Execute jQuery once Angular has completed rendering

My aim is to populate a profile page with a JSON object in AngularJS by utilizing directives. The structure involves a profile directive with profile-section directives as its children, and profile sub-section directives within the sections. One challenge ...

Adding JavaScript code to Rails erb snippets

I have a complex select block created using Rails erb, and I now need to convert it to jQuery using append. Here is the original select block: <select id="mission_reward" name="mission_reward" class="select_reward"> <option value="0"><%= ...

Toggle switch experiencing issues following removal of an h1 tag

After deleting an h1 element, my toggle switch started malfunctioning. Initially centered within the slider, it is now offset to the top. However, clicking the button corrects its position temporarily. Upon refreshing the page, the offset issue reappears. ...

Submitting information through a form enclosed within script tags

Hey there, I'm encountering an issue with a form that's inside script tags. After clicking on the save button, nothing happens. Here is the code: <script id="e1" type="text/x-jquery-tmpl"> <form id="MainForm" > <i ...

Accessing a child element within a div with the help of the keyword "this" in jQuery

I am encountering an issue with accessing and updating attributes of iframe elements within HTML containers on a page. When I attempt to loop through each "iframeHolder" and target the iframe element within it, I encounter errors. Below the HTML code snip ...

What could be causing the drop-down list to remain fixed at the top and bottom while scrolling?

Whenever I open the drop-down and start scrolling, the list either sticks to the top or the bottom of the div. I tried switching the positions of the parent div and the drop list, but I couldn't find a solution. Is there any way to make the drop-list ...

The selection discrepancy is due to the misalignment between the cursor and white space in the CSS styling

Upon close inspection, I've discovered that a discrepancy exists between the selection on my webpage and the cursor position. After investigating further, I uncovered the following reasons: Presence of white-space between the start tag <p> and ...

Prevent hovering on the date picker header

I have a bootstrap date picker inside a table with the hover option. When accessing the date picker, the first two rows displaying the month and day are being overridden by CSS from the table, and after hovering, the side text turns white. Here is a worki ...

Stylized widget for showcasing a list of cities for meetups

After extensive searching, I have yet to find a solution to stylize the "City List" widget for Meetup. The specific widget I am focusing on is the first one listed here. () Despite exploring various options such as the widget foundry and conducting onlin ...

Is there a discrepancy in absolute positioning offset between IE7 and Firefox?

I'm currently reorganizing a fellow developer's code, and it seems that the CSS work was done poorly. Within the main "wrapper" div on the page, there are logos and navigation images. The images are positioned using "position: absolute" and the ...

Problematic response design

On my responsive website, I am utilizing the hr tag in various places. However, I have noticed that some lines appear with different thicknesses, as shown in the example below. For a demonstration, you can view a sample on this fiddle: http://fiddle.jshel ...