@manton What would be the easiest way to get a count of all posts via the API (xml-rpc or otherwise)?
@manton What would be the easiest way to get a count of all posts via the API (xml-rpc or otherwise)?
@matti Probably to use the Micropub API to page through the posts and count them... micro.blog/micropub?config=source
and pass offset
with e.g. 0, 100, 200... We should probably have an easier count somewhere. (If you do have to loop through and get a bunch of posts, I recommend adding a tiny bit of a delay, even 1/10th of a second.)
@matti @manton If you want to save on requests and are okay with not using an API, simply counting URLs in sitemap.xml
could be an alternative.
For example, you could do this from the terminal: curl --silent "https://blog.martin-haehnel.de/sitemap.xml" | grep "de/20" | wc -l
.
In English: fetch the sitemap and count all the lines containing de/20. This works because your blog posts exist on paths like /2022/10/02/dailydogo.html. This hack assumes you have no blog posts before 2000 and will quit blogging before the next century. 😊