Basic - Recent Posts

[Yellow Field] Domain name should be changed.
<script>
    var numposts = 4;
    var isList = true;
    function showrecentposts(json) {
      for (var i = 0; i < 4; i++) {
        var entry = json.feed.entry[i];
        var postTitle = entry.title.$t;
        var postUrl;
        if (i == json.feed.entry.length) break;
        for (var k = 0; k < entry.link.length; k++) {
          if (entry.link[k].rel == "alternate") {
            postUrl = entry.link[k].href;
            break;
          }}
        postTitle = postTitle.link(postUrl);
        if (isList) document.write("<li>");
        document.write(postTitle);}
        if (isList) document.write("</li>");
    }
    </script>

<br />
<ul>
    <script src="//btdocumentation.blogspot.com/feeds/posts/default?max-results=900&amp;alt=json-in-script&amp;callback=showrecentposts">
</script>
    </ul>

No comments:

Post a Comment