How to Promote your Content by Creating and Sticking Index Page in Blogger


Awesome Tips Series about Blogger

TL;DR

  • How to create a page which includes posts you would like to promote.
  • Stick it in your blogger.
  • Create a Custom “Page Not Found” to promote Posts.

Create an automatically updated index page

  • Include Sections about New Posts, Recently Updated Posts, New Posts based on Labels
The Implementation
  • Based on the code from here
<script type="text/javascript">
  //<![CDATA[  
  const newPublishedPosts = new Set();
  function showNewPosts(json) {
    var toIgnoreSet = new Set();
    showPostsImpl(json, 20, toIgnoreSet, newPublishedPosts)
  }
  function showUpdatedPosts(json) {
    var toIgnoreSet = newPublishedPosts;
    showPostsImpl(json, 10, toIgnoreSet);
  }
  function showPosts(json, totalposts, toIgnoreSet, addedSet) {
    showPostsImpl(json, 1000);
  }  
  function showPostsImpl(json, totalposts, toIgnoreSet, addedSet) {
    for (var count = 0, publishedCount=0; publishedCount < totalposts && count< json.feed.entry.length ; count++) {
      var entry = json.feed.entry[count];
      var postTitle = entry.title.$t;
      var posturl;
      // if (count == json.feed.entry.length) break;
      for (var b = 0; b < entry.link.length; b++) {
        if (entry.link[b].rel == 'alternate') {
          posturl = entry.link[b].href;
          break;
        }
      }
      if(postTitle == "home") continue;
      if(postTitle.toLowerCase().startsWith("draft")) continue;
      if(toIgnoreSet && toIgnoreSet.has(postTitle)) continue;
      if(addedSet) addedSet.add(postTitle)
      publishedCount++;
      document.write('<li>');
      document.write(postTitle.link(posturl));
      document.write('</li>');
    }
  }
  //]]>    
</script>
<br />
<h3>Popular Posts</h3>
<script src="https://lifelongprogrammer.blogspot.com/feeds/posts/default/-/Promo-Main?orderby=updated&amp;alt=json-in-script&amp;callback=showNewPosts&amp;max-results=10"></script>

<br />
<h3>New Posts</h3>
<script src="https://lifelongprogrammer.blogspot.com/feeds/posts/default/?orderby=published&amp;alt=json-in-script&amp;callback=showNewPosts&amp;max-results=21"></script>

<br />
<h3>Updated Posts</h3>
<script src="https://lifelongprogrammer.blogspot.com/feeds/posts/default/?orderby=updated&amp;alt=json-in-script&amp;callback=showUpdatedPosts&amp;max-results=31"></script>

<br />
<h2>Development</h2>
<h3><a href="/search/label/Dev%20Tips">Dev Tips</a></h3>
<script src="https://lifelongprogrammer.blogspot.com/feeds/posts/default/-/Dev Tips?orderby=updated&amp;alt=json-in-script&amp;callback=showPosts&amp;max-results=20"></script>

Make a Sticky Post in Blogger

  • Publish the post first then change date to a future date

Create a Custom “Page Not Found” to promote Posts

Resources


Labels

adsense (5) Algorithm (69) Algorithm Series (35) Android (7) ANT (6) bat (8) Big Data (7) Blogger (14) Bugs (6) Cache (5) Chrome (19) Code Example (29) Code Quality (7) Coding Skills (5) Database (7) Debug (16) Design (5) Dev Tips (63) Eclipse (32) Git (5) Google (33) Guava (7) How to (9) Http Client (8) IDE (7) Interview (88) J2EE (13) J2SE (49) Java (186) JavaScript (27) JSON (7) Learning code (9) Lesson Learned (6) Linux (26) Lucene-Solr (112) Mac (10) Maven (8) Network (9) Nutch2 (18) Performance (9) PowerShell (11) Problem Solving (11) Programmer Skills (6) regex (5) Scala (6) Security (9) Soft Skills (38) Spring (22) System Design (11) Testing (7) Text Mining (14) Tips (17) Tools (24) Troubleshooting (29) UIMA (9) Web Development (19) Windows (21) xml (5)