I have this script:
<script type="text/javascript">
function getposttitle(json) {
// Get total posts
var totalposts = json.feed.openSearch$totalResults.$t;
for (var i = 0; i < totalposts; i++)
{
var posturl;
// Get rel=alternate for truly post url
for (var j=0; j < json.feed.entry[i].link.length; j++)
{
if (json.feed.entry[i].link[j].rel == 'alternate')
{
break;
}
}
var poststitle = json.feed.entry[i].title.$t;
document.write(' '+poststitle+'<br/>');
}
}
</script>
<script type="text/javascript" src="http://BLOGURL.blogspot.com/feeds/posts/default/-/BLOGLABEL?alt=json-in-script&max-results=10000&callback=getposttitle"></script>
Now what should i change to sort it as an alphabet list?
And any idea to remove the &max-results=10000 because if i remove it, only 25 results appear.
Here is the link to the API: https://developers.google.com/blogger/docs/2.0/developers_guide_protocol
There are two parameters that are relevant to your question:
max-results: The maximum number of entries to return.
orderby: The order in which to return entries, such as lastmodified (the default), starttime, or updated.
Where you have this:
src="http://BLOGURL.blogspot.com/feeds/posts/default/-/BLOGLABEL?alt=json-in-script&max-results=10000&callback=getposttitle">
Change it to this:
src="http://BLOGURL.blogspot.com/feeds/posts/default/-/BLOGLABEL?alt=json-in-script&max-results=10000&orderby=title&callback=getposttitle">
Here I chose the title field as the field to order by rather than the default field (lastmodified). You can set max-results to a smaller number, for example 100, to get fewer results back.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.