stefansundin / rssbox

:newspaper: I consume the world via RSS feeds, and this is my attempt to keep it that way.
https://github.com/stefansundin/rssbox/discussions/64
GNU Affero General Public License v3.0
770 stars 73 forks source link

Jekyll Github Pages (github.io) #54

Open synap5e opened 2 years ago

synap5e commented 2 years ago

It's common for people to use Github pages as a free host for their blogs. Often this is done with Jekyll, which means a common pattern can be identified.

Given a jekyll blog <username>.github.io the posts can be queried by the API https://api.github.com/repos/<username>/<username>.github.io/contents/posts (max 1000 files) Each file will have a path which we can create the page url by concatenating to the original blog with the extension changed from .md to .html https://<username>.github.io/<path | changesuffix('.html')>

If we need to get creation/modification date the API https://api.github.com/repos/phra/phra.github.io/commits?path=posts/zwc-fingerprint.md&page=1&per_page=1 (with bigger page size and choosing last for getting creation date).

This would support custom-domain blogs too, provided the user can find the original. Perhaps doing a redirect check on the final url to support custom domains better would be desirable.

stefansundin commented 2 years ago

Hey. Sorry, I completely missed this when you filed it.

One thing that is possible, but it requires cooperation from the author, is to publish an RSS feed like this: https://github.com/stefansundin/privatkopiera/blob/gh-pages/feed.xml

You can see the result here:

Another option that may be ok is to subscribe to the commits from GitHub, e.g. https://github.com/phra/phra.github.io/commits.atom

If the blog isn't on the default branch (e.g. gh-pages) then use https://github.com/stefansundin/privatkopiera/commits/gh-pages.atom

So that's one potential workaround.

I am not sure if I want to implement this idea, but I'll think about it. Thanks for filing it!