Latest News

Showing posts with label Template Tweaks. Show all posts
Showing posts with label Template Tweaks. Show all posts

Custom Domains And HTTPS Redirection Code

As most of us know, Blogger HTTPS support does not include custom domain publishing.

The advantages offered by HTTPS access are widely advertised - and have led to envy between blog owners who publish to custom domains, and native BlogSpot blog owners proudly advertising their new HTTPS connectivity.

Long ago, we saw possibly malicious code which helps our readers avoid using country code aliases, to read our blogs from an aliased country. Recently, there was dodgy code which blocked HTTPS mode, to read a customised blog.

Now, we have custom code to force HTTPS access, for BlogSpot published blogs.

Along with providing code to help blog owners avoid country local domain aliasing, some marginally helpful hackers are providing code to help blog owners force reader access to HTTPS.

Some blog owners always wanted HTTPS to be used, to access their blog.

Some blog owners wanted their readers always using HTTPS to access their blogs, before forced HTTPS access became an option. They Googled, and found, semi helpful hackers who provide clever code to force the "HTTP --> HTTPS" redirection.

<script type='text/javascript'>
$(document).ready(function() {
  $("a[href^='http://']").each(
    function(){
      if(this.href.indexOf(location.hostname) == -1) {
        $(this).attr('target', '_blank');
      }
    }
  );
  $("a[href^='https://']").each
    function(){
      if(this.href.indexOf(location.hostname) == -1) {
        $(this).attr('target', '_blank');
      }
    }
  );
});
</script>


This is clever code - when only BlogSpot access is involved. When you add BlogSpot to custom domain redirection, it becomes another "404".



Adding this clever code is an excellent solution - until the blog owner forgets about it, and later upgrades to a non BlogSpot custom domain.

With a custom domain published blog, the redirection becomes a problem.

The added code contains no exception to permit custom domain published blogs to remain in HTTP mode. When accessing an otherwise properly setup custom domain published blog, from a reader using the "blogspot.com" URL, this prevents the BlogSpot to domain redirect from operating.

BlogSpot URLs, which should redirect to the HTTP published custom domain URL, instead redirect to a non existent HTTPS URL - and result in another "404". As the custom domain URL becomes more commonly used for a recently published blog, confusion increases when the rarer BlogSpot URL reference is encountered.

My blog has been using the domain URL for months, why is this happening now?

The problem involves dual redirection - to "https:" mode, and to the custom domain.

After painful problem diagnosis, we find the clever redirection code buried in template HTML - and we see that the blog reader is starting from the BlogSpot URL, and using the BlogSpot to domain redirection, to access the blog.

With blog access redirected to "https:" mode, then subsequently to the custom domain URL, the readers sees a "404" - because the custom domain URL is not available as "https:" content.

This problem will become increasingly rarer - but not extinct.

As self caused custom domain victims become rarer, this way of breaking ones own blog will become more obscure - and it's likely that some cases will go, unsolved. This will be similar to the problem of un migrated classic templates, which has increasingly less experienced support.

If you must install unsupported template tweaks into your template - consider the long term effects. Learn to recognise a problem that you have caused, to your own blog.

Not every helper will realise that you have added custom redirection code - and when looking at the problem code, when a problem is reported, will recognise it for what it is. Your problem may remain your problem - at least, until Blogger Engineering completes Blogger SSL integration (may this happen soon).



Some blog owners have added clever HTTP to HTTPS redirection code, acquired from helpful third party providers, installed in the template. When later publishing a blog to a custom domain, this code will prevent proper blog access - and as installed, may not be easily recognised.

https://productforums.google.com/forum/#!category-topic/blogger/bl5W39BKX4U

Sharing Blog Content, With Photos, To FaceBook

We have a few blog owners, reporting problems with sharing their blogs to FaceBook.
When I share my blog on FaceBook, the photo from the blog doesn't appear. Some blurry pencil appears instead.
What the blog owner is seeing, is the effect of the FaceBook Share wizard, grabbing an unwanted photo, from the page being shared.

You have 2 choices, if you want to share blog content to FaceBook - and have it all look attractive.
  1. Publish every post, containing a photo that FaceBook will want to use.
  2. Add FaceBook Open Graph code, to your blog.

Too many blogs do not contain quality photos, per FaceBook Standard.



(Update 3/14): Blogger Engineering having recently added OG code to the standard template header, this tweak may be unnecessary for most blog owners.


The problem, that too many blog owners have, is that their photos do not have the correct quality, to FaceBook.

  • At least 200×200 pixels in both width and height.
  • Aspect ratio of width and height no greater than 3; in other words, the width can’t be more than three times more than the height, and vice versa.

Please define a chosen image using the og:image metatag, and use an image that's at least 200x200px and is accessible from Facebook.

Current opinion seems to suggest that an image of minimum size 400 x 400 px is better than 200 x 200 px. In other words, the image which fits neatly into the post column may not be a good choice.

Without a suitable photo in shared content, FaceBook Share gets imaginative.

If your main page, or post page, does not contain an acceptable photo, the FaceBook Share wizard will pick an image from the page. The first thing that the wizard looks for is a transparent image.

This is where the infamous "pencil" or a similar image becomes involved. The "pencil" - if the blog owner is doing the sharing - is found at the bottom of the post. It's also known as the "Quick Edit" icon.

If Quick Edit is not enabled, or the person submitting the share is not a blog owner, the "pencil" won't be available. In this case, FaceBook Share will grab a similar icon, from the blog face - or maybe from the sidebar.

We need Open Graph code, to instruct FaceBook Share how to find a photo.

FaceBook Open Graph code is not hard to develop - or install - but you do need to use the right code.

If you want something better than the "pencil" or similar fluff from being included in your shares, you add FaceBook Open Graph code, to tell FaceBook how to find an appropriate photo. You can specify a photo to include when the main page is shared - and (if you like) a different photo to include when a post, with no photo, is shared.

Some very simple code - not!

One would be helper has been making forum noise recently, with some very simple code.

<!-- Open Graph Meta Tags BEGIN -->
<b:if cond='data:blog.postImageUrl'>
<meta expr:content='data:blog.postImageUrl' property='og:image'/>
</b:if>
<!-- Open Graph Meta Tags END -->

There are two problems with this simple code.

  1. It's based on post code - and has nothing to make a main page share come out right.
  2. It requires a suitable image, in the post. We are here, because many posts do not have suitable images.

Something more than the simple code is needed.

Develop the proper simple code.

So the simple code requires a little more effort. This is what I recommend:

<!-- BEGIN Open Graph tags -->
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.postImageUrl'>
<meta expr:content='data:blog.postImageUrl' property='og:image'/>
<b:else/>
<meta content='http://xxxxxxxxxxxxxxxxx/xxxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxx/S1600-R/yyyyyyyyyyyyy.gif' property='og:image'/>
</b:if>
<b:else/>
<meta content='http://xxxxxxxxxxxxxxxxx/xxxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxx/S1600-R/yyyyyyyyyyyyy.gif' property='og:image'/>
</b:if>
<!-- END Open Graph tags -->

There are two alternate possibilities that we want to allow for.

  1. Sharing the blog itself - and no post containing an acceptable image, on the main page.
  2. Sharing a post - and no acceptable image, in the post

Please note that http://xxxxxxxxxxxxxxxxx/xxxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxx/S1600-R/yyyyyyyyyyyyy.gif needs to be replaced with an actual URL of a real photo, that fulfills FaceBook requirements, for this feature to be useful. Choose a good photo, that will represent the blog when shared in main page, or a post with no suitable photo.

Now, I need a default photo, to use when no acceptable image is involved, when sharing this blog. Here's a screen print of the opening page of this post.




And, the URL from the screen print.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiim6Npm_l_FkmnT7M2ZR-OrQLuaD42SAiDRyhAhXOf4pbRideSrn2hXzBgZo8XhzMGhxxjt50a2LTJOSE-ZRrg7RNX2mz1z5q-KNmf3YWCAyArC1Jh2lytWZc2op4UTULruOpMJMIhqo2w/s1600/Screenshot+2016-02-15+at+13.08.21.png

This gives me:

<!-- BEGIN Open Graph tags -->
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.postImageUrl'>
<meta expr:content='data:blog.postImageUrl' property='og:image'/>
<b:else/>
<meta content='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiim6Npm_l_FkmnT7M2ZR-OrQLuaD42SAiDRyhAhXOf4pbRideSrn2hXzBgZo8XhzMGhxxjt50a2LTJOSE-ZRrg7RNX2mz1z5q-KNmf3YWCAyArC1Jh2lytWZc2op4UTULruOpMJMIhqo2w/s1600/Screenshot+2016-02-15+at+13.08.21.png' property='og:image'/>
</b:if>
<b:else/>
<meta content='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiim6Npm_l_FkmnT7M2ZR-OrQLuaD42SAiDRyhAhXOf4pbRideSrn2hXzBgZo8XhzMGhxxjt50a2LTJOSE-ZRrg7RNX2mz1z5q-KNmf3YWCAyArC1Jh2lytWZc2op4UTULruOpMJMIhqo2w/s1600/Screenshot+2016-02-15+at+13.08.21.png' property='og:image'/>
</b:if>
<!-- END Open Graph tags →

And, there is the simple OG code, that I might use for sharing this blog, with a proper image, to FaceBook. This is actually a portion of the code needed, when adding author identification to FaceBook shares.

You might use similar code - having chosen and developed a good quality photo, to represent your blog.

Install the proper simple code.

To install the code, you will use the Template Editor. Please backup the template, before and after you make this simple change!

Start by locating the "<HTML ... >" tag, at the top of the template header.

Find:

<html b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>

And replace with:

<html b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<!-- BEGIN Open Graph tags -->
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.postImageUrl'>
<meta expr:content='data:blog.postImageUrl' property='og:image'/>
<b:else/>
<meta content='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiim6Npm_l_FkmnT7M2ZR-OrQLuaD42SAiDRyhAhXOf4pbRideSrn2hXzBgZo8XhzMGhxxjt50a2LTJOSE-ZRrg7RNX2mz1z5q-KNmf3YWCAyArC1Jh2lytWZc2op4UTULruOpMJMIhqo2w/s1600/Screenshot+2016-02-15+at+13.08.21.png' property='og:image'/>
</b:if>
<b:else/>
<meta content='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiim6Npm_l_FkmnT7M2ZR-OrQLuaD42SAiDRyhAhXOf4pbRideSrn2hXzBgZo8XhzMGhxxjt50a2LTJOSE-ZRrg7RNX2mz1z5q-KNmf3YWCAyArC1Jh2lytWZc2op4UTULruOpMJMIhqo2w/s1600/Screenshot+2016-02-15+at+13.08.21.png' property='og:image'/>
</b:if>
<!-- END Open Graph tags →

Save the changes. And again, backup the template, before and after you make this simple change!

And with the code added to your template, you can verify your code. In extreme cases, you may need advice from FaceBook Support. You may also find FaceBook Developers: Sharing Best Practices for Websites & Mobile Apps to be a helpful reference.

---

Many #Blogger blog owners share posts (and the blog itself) to FaceBook, with no problems. Some have recently observed odd images being included with the content shared.

An apparent change to the FaceBook Sharing wizard has caused odd photos to be included, with blogs that lack the necessary Open Graph code. Open Graph code is not complicated - but it does need to allow for possibilities.

The LightBox Image Display Option Stopped Working, Recently

Last week, the popular display option, Lightbox, used for showing full size images in Blogger blogs, stopped working.

Anxious blog owners reported that full size images are now being displayed in a normal browser window, with the browser back arrow required to return to the blog display - instead of the elegant black background overlay with the mysterious "X" which closes the overlay. The problem appears to affect all images in the blogs affected.

An immediate sampling of the forum problem reports suggested that it's likely that all Blogger blogs are affected. Since not all blogs may contain enough images, and be owned by people who are attentive enough, we are not seeing massive volumes of problem reports.

We did open a rollup discussion, in Blogger Help Forum: Something Is Broken, where we are gathering a good sample of the blogs involved. To date, no obvious affinity has been discovered, in the over 100 responses posted.

Today, we have a mysterious suggestion, posted in a forum discussion, which may provide a workaround for the problem.

We are advised to add a brief snippet of code to the template.

<script src='http://www.blogger.com/static/v1/jsbin/2321381434-lbx__fr.js' type='text/javascript'/>

The snippet in question is added to the very end of the template, using the "Edit HTML" option, in the dashboard Template wizard, after </body>, and before </html>.
</script>
</body>
<script src='http://www.blogger.com/static/v1/jsbin/2321381434-lbx__fr.js' type='text/javascript'></script>
</html>

I added this snippet of code to the template for this blog. I don't use a lot of images in this blog - but you may examine one previous post, where you will find a picture. If you click on that one picture, you will see the full size image displayed in Lightbox format - which was not the case, earlier today.

The code snippet in question is hosted in "blogger.com", so it should be safe. And, it's not difficult to add - or to remove. That said, I have no idea if it may conflict with other code - so anything is possible. It is marginally more reliable than third party code.

I've done no further testing of this fix, so I'll await your feedback. You may comment here - or in the rollup discussion.

Remove The "Next Blog" Link From The Navbar

Ever since Blogger added the "Next Blog" link to the Blogger Navbar, blog owner and readers alike have periodically asked one question, in Blogger Help Forum: How Do I?.
How do I remove the "Next Blog" link, from the Navbar?
The "Next Blog" link, long ago added to generate random traffic for new blogs, is occasionally perceived as leading unwary readers to blogs where they should not wish to go. Some "adults" of various intention have asked this question, quite seriously, in fear of their blogs being inadvertently linked to blogs with unsavoury content.

The navbar coded as it is, there is no known ability to customise it, and to remove specific elements such as the "Next Blog" link. Generally, we simply advise people, when they have the need, to remove the Navbar.
Use the Layout wizard, Edit the "Navbar" gadget, and select "Off".

That noted, it is possible to remove the "Next Blog" link (and all buttons and links to its left), with a bit of CSS - for blogs with the owner able and comfortable with using the Template Designer. For a simple way to remove the "Next Blog" link, use the "Add CSS" menu option in the Template Designer, and add one snippet of code.
#navbar-iframe {
margin-left:-510px;
}

When you do this, you will lose 5 other buttons and links.
  • The dashboard icon.
  • The Blog Search window.
  • The "G+ Share" icon.
  • The share count display.
  • The multi-function share / "Report Abuse" menu.
So hackers / spammers will appreciate the last menu being unavailable, on their blogs.

You may see this tweak demonstrated, in my New Template Laboratory. It's an ugly solution - but for blog owners who truly don't want their blogs linking to "Next Blog", it may be useful.

>> Top

Some Blog Owners Reporting The Template Designer Changes Do Not Update On Their Blogs

For several weeks, we're been seeing various reports in Blogger Help Forum: Something Is Broken, mentioning problems with template updates, being made using the Template Designer wizard.

The reports are not so widespread to indicate a complete malfunction - but neither can we dismiss the problem, as being unique to one browser, one template type, or one particular update pattern.

It's likely that we are looking at a number of problems, aggregated and compounded, into one common symptom.
I cannot Save changes in Template Designer.
With a problem report like this, some examining of the details may be appropriate.

The Template Designer wizard, which is a component in the Blogger Dashboard, is a complex and sophisticated collection of menus and utilities, which runs on the blog owners computers.

Like most Blogger code, the Template Designer is subject to the effects of other programs, and various security settings - which may be installed or set on each individual computer, with or without the understanding of the blog owner and / or computer owner. In some cases, the blog owner and computer owner may be different people.

If you are seeing a problem with the Template Designer, when trying to update the layout on your blog, there are several tests which you can make, which may help to isolate the problem.
  • Try making the same updates, using another computer.
  • Try making the same updates, using another browser on your current computer.
  • Try setting up a new blog, with the same template, and make the same updates to the new blog.
If you're able to make one or more of the above alternate updates, that will help to eliminate some, or many, alternate suspects, as the cause of your problem. If other people are reporting this problem, their results from the above tests may or may not correspond with yours - because their base problem may differ from yours.

Right now, we're seeing seven different causes of these problems.
  1. Changes made by Blogger Engineering, to support new browser versions and browser updates, and to provide new template features.
  2. Changes inherent in new browser versions, made by the browser vendors.
  3. Third party browser add-ons, installed by the owners of the various computers.
  4. Security settings, inherent in new browser versions and third party add-ons.
  5. The cumulative effects of various template tweaks, both made using "Edit HTML" and the Template Designer itself.
  6. Unrealistic expectations of blog owners, about effects of Template Designer settings, against all templates provided by Blogger.
  7. Unrealistic expectations of blog owners, about effects of Template Designer settings, against templates not provided by Blogger.
Of these possible causes, only #1 (and possibly #2 and #6) are the sole responsibility of Blogger Engineering. The blog owners (and computer owners) must assume some partial responsibility for #2 - and sole responsibility for #3, #4, and #5. The blog owner, and the developer of any custom, third party template, must jointly assume responsibility for #7.

Recently, Blogger Support acknowledged the problem, in part.
Some users have reported that the Apply to Blog button in the Template Designer is non-functional for some Dynamic View templates.
We also have a Rollup Discussion, in Blogger Help Forum: Something Is Broken, where individual details are being provided by various blog owners.

Right now, we're starting to suspect that some "problems" are actually caused by the blog owners, who are simply not aware that not all changes made, using the Template Designer (or the Layout or Template "Edit HTML" wizards), are designed to update all templates used in viewing our blogs.

Template Designer Upgrades Require Supporting Updates To The Individual Blog Templates

This week, we're seeing a small flood of problem reports in Blogger Help Forum: Something Is Broken about problems with the Template Designer.
Every time I change something, I have to refresh the page in order for it to show up. It won't "Save" when I try to save the layout changes. It just says "Saving..." at the top of the page and fades away, but doesn't actually save any changes.

Many problems involve changes made to the template, using the Designer, which aren't being saved - or are broken when saved. Most of the people reporting these problems have made changes to the template, previously - some are so experienced at making changes, they can't believe that their latest changes could ever have problems.

Interestingly, this history of changes is not a coincidence - and it's likely that some of the changes helps to cause these problems.

Take a look at the template code in your blog, some time. You'll notice a lot of code which doesn't look like CSS, HTML, or XML. Some of it is code which supports the various blog features that are adjusted or configured using the Template Designer.

Many template features involve two sets of code.
  1. The Template Designer wizard, part of the Blogger dashboard, is common code used by all blog owners.
  2. The blog template, post template, and / or widget template, is part of the individual blogs. Some template code does nothing but support the Template Designer - and let you configure your blog layout,
Every time Blogger Engineering adds or updates template features, they have to make changes to both sets of code.

Blogger Engineering does not edit each individual blog, after they upgrade the Template Designer. They make changes to the master template code - and their changes replicate into the individual blog templates. These changes replicate much more consistently, when the individual templates have not been changed.

The more custom a template is, with changes applied by the blog owner, or possibly in a third party template, the less likely it is to properly update, to support each succeeding Template Designer update.

Any time Blogger Engineering updates the Template Designer, to add a new feature, or maybe to support a new browser version, their updates may require changes which are not properly applied to all blogs - and the Template Designer stops working, in some blogs.

When the Template Designer stops working, the usual recommendation is to refresh the post or widget template - or maybe to upgrade the blog template - and things start rolling again. And the blog owner goes back to tweaking the template, until something breaks again.

>> Top

Contact Us

24x7 online , we happy to answer you
tamilcypc@gmail.com

Disclaimer

This Blog and its TUT's are intended for educational purposes only, no-one involved in the creation of this TuT may be held responsible for any illegal acts brought about by this Blog or TuT.



Featured Post

Custom Domains And HTTPS Redirection Code