Monday 29 July 2013

How to Add an Excerpt of Your Blog Post When Posting a Link on Facebook - Instead of the Blog Description

When I write a blog post I like to put a link on my Facebook page to try to increase visitors. Facebook has a feature where it will grab a brief excerpt off the website you are linking. Unfortunately with blogger, on my blog, it will always grab the description of the blog and not an except of the blog post like I wish it to.

Facebook grabs the first paragraph, this is a piece of text which has the p tag. So all you have to do is to remove the <p> tag around the description and add up a <p> tag around the blog post. This is easier said than done.

Log on to Blogger click template then on edit HTML. Scroll down until you find code like this. It can be extremely difficult to find, it is probably easier to copy it into a text editor and do a search.

<b:includable id='description'>
  <div class='descriptionwrapper'>
    <p class='description'><span><data:description/></span></p>
  </div>
</b:includable>


I edited it removing the <p> tag as you can see below.

<b:includable id='description'>
  <div class='descriptionwrapper'>
    <span class='description'><data:description/></span>
  </div>
</b:includable>


Now all you need to do is find the body, select the jump to widget drop down box and select blog. Code that you need to find could be hidden as Florida likes to collapse the code to make things easier to find - which actually makes everything a lot harder to find. To expand the code you click of those arrows next to the line numbers.

The code should look like this:

<data:post.body/>

Change the code to look like this:

<p><data:post.body/></p>

Warning: Please back up your blog template before doing this. I take no responsibility for your blog gaining sentience and then destroying the human race.

No comments:

Post a Comment

hizzer