I not at all familiar with Javascript. I have a script on Blogger for generating a link to a random post, but due to Blogger's restrictions, I can't get more than the latest 100 posts from the JSON call. I want to try to get around this by randomly assigning the starting point. The portion in question is:
<script src='/feeds/posts/summary?alt=json-in-script&callback=rp_results_label&start-index=200'/>
How can I replace that 200 with a randomly generated number?
Thank you
Utilizing the Math.random will help with achieving what you require. Also adding
max-results=1query parameter to the feed URL will limit the results to a single post. As we can't add Javascript variables directly in thescripttag's src, we will have to load it via JavaScript.You can replace
201with any integer between1to(total number of published posts on the blog)+1