Dynamically Updated JS File for Blogger Shortcodes Not Working. [Error Reported]


#1

Hello everyone,

I found that the JS file provided by MBT for blogger shortcodes, has got some errors. It not running properly and when included in any blog, messes it completely. I tried on many of my blog’s and the error was also reported by one of my good friend. Hope @Mohammad will work on it soon and solve the error.

If some one is also facing such problem, he/she can simply removve all the codes corresponding to the shortcodes provided by MBT, till when MB will solve the error.


#2

@namankumar I don’t think so all the shortcodes on my blog are woking perfectly fine :wink:


#3

did you use, notification boxes or youtube shortcodes.


#4

@NamanKumar I think this is because @Mohammad has compressed Shortcode JavaScript file. Sometimes this happen because JavaScript compressor tools remove some sign like (:wink: that don’t work on Blogger. Some days ago I had also compressed my template’s JavaScript from a compressor tool and after compressing, the JavaScript stopped working.


#5

May be that is the problem, hope he’ll find the solution soon.


#6

Yes. He will solve it soon, :smile:


#7

Same Here When I Tried To Add The Shortcode Script My Template Was Not Running Fine And was having glitches :cry: Also Notification Boxes Were Not Working :cry:


#8

@ngtechzone @NamanKumar Same Here the notification box short code is not working on my blog.


#9

I don’t know why but they are working the notification boxes :sweat:


#10

I can just hope that @Mohammad will reach us soon.


#11

Not working on my blog @Nafees

I don’t know why but other short codes are working.


#12

Naman and Hassan, for now, keep this in your blog’s any widget for get it working because if your visitors see your blog post things not working, they will get away from your blog.

/*
 * Blogger Shortcode Plugin By Mohammad Mustafa Ahmedzai
 * Examples and documentation at: http://www.MyBloggerTricks.com
 * Copyright (c) 2008-2015 STCnetwork.org
 * Version: 1.0 (29-March-2015)
 * Dual licensed under the MIT and GPL licenses.
 * Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
 */
$(document).ready(function() {
    // Notification Boxes Shortcode
    $('.sc-alert, .sc-warning, .sc-update, .sc-success, .sc-info').addClass('sc-notification');
    $('.sc-notification').each(function () {
        var M = $(this).attr('headline');
        var B = $(this).html();
        if (M == null) {
            M = '';
        }
        if (B == null) {
            B = '';
        }
        if (M != '') {
            M = '<div class="headline">' + M + '</div>';
        }
        $(this).html('<div class="wrapper">' + M + B + '</div>');
    });
});

Don’t try to remove comments please.


#13

@NamanKumar I recently optimized the code further and have further compressed it. The code is working just fine on our demo pages.

@Shivansh The code compressor we used takes care of the delimiter and all mbt scripts are compressed using it and we take care of it on daily basis. The reason why it don’t works for you sometime is because you are hosting it on Google drive and I mentioned earlier that it is not the right approach and discuss alternative way.

Reasons When It Does not work for you

Take all the below points seriously because it will massively improve your overall search presence and Page-views too.

Following are the Google PageSpeed Insights Score for your Blog

Mobile: 36/100

Desktop: 41/100

This score is enough an evidence why you need to take some major steps to better optimize your blog.

You are using a template that is making several ajax calls to fetch content through a FEED api and then display it. Recently I am seeing more of such fancy templates on themeforest too which are unfortunately too poorly coded and optimized. Such scripts reduces load time immensely due to several http requests and ajax calls. We had applied a similar script on mbt and it dropped our traffic by 50%, we then restored our layout back to the traditional two column which is doing great now. You need to stop using these scripts or at least reduce the number of label widgets on your homepage.

Such templates do give rise to JS conflicts and the browser fails to accept so many JS requests at a time. People don’t have fast internet connectivity so it would work for those with fast browsing speeds but it wont for people experiencing slow browsing speeds.

Alternative Solution

I am publishing a Post on BHF right now where I will guide you how to host the script directly on your blogger blog, but you will need to manually update it when we publish a new shortcode.


#14

Mohammad, I am not using it through Google Drive. I have pasted the required shortcodes in a HTML/JavaScript widget which made my blog’s loading speed fast and the shortcodes are working fine for me!

I have only added shortcodes which I need and this is the advantage of pasting it directly to template.


#15

Hey @Mohammad , can you please check my blog and give me some tips how to improve page load speed .


#16

@NamanKumar, I suggest you to post this in a new topic so everyone will give you their suggestions :smile:


#17

@Mohammad, some time ago I had compressed my blog’s JavaScript but it stopped working. My compressor was sf-refresh.com. Why?


#18

Buddy use these two tools to make sure no sytax is broken and the code is compressed without messing up its logic.

For CSS, use CSScompressor.com and for JS always use Javascriptcompressor.com

The default options on these sites are always best. :thumbsup:

@NamanKumar Buddy my most geniune advise right now would be to avoid using a magazine style layout which may use AJAX to load content inside widgets and try to focus on this fact :

A visitor only takes 3 seconds to decide if he wishes to read content on your site or not, if your site loads in 15 seconds or above, then how come anyone would have that patience to stay for all that fancy animation to load and then read your content? Give more value to Site load time and Optimization and less to Its looks. We recently made a lot of changes to mbt and it now loads within 3 seconds (2.4 to be exact) , its mobile load time is even less and it has now a 100% score for mobile Interface. If we stop accepting buysellads banners then mbt’s actual speed would be less than 2.4 seconds but you know we cant do that and only try to make it better

Update:

@NamanKumar here you go! :smile:

:link: How to Host Shortcodes directly inside your Template?


#19

Thanks for help sir. I surely try to improve my template or just to change it. Catch you on other topic. :smile:


#20

Thanks sir, with the help your your advice and the Pingdom tool, I’m able to reduce my page load time to 2.56 seconds from 20.1 seconds.