Crate rss_autogen_giscus

Source
Expand description

Autogenerate GitHub Discussions to be used by Giscus.

This came from a need to support Giscus without requiring users to authenticate with the app. Since the discussion isn’t created until someone comments, we needed a way to automatically create it once a blog post was uploaded.

This crate checks for the latest post in the blog’s RSS feed, and then extracts the contents needed to create a discussion post, formatted as follows:

  • Title: URL path of the post (not including base URL)
  • Description: Pulled from the <meta name="description"> tag, followed by a full link

The program works best when run after the RSS feed has been updated with the most recent post. This may require you to introduce a delay.

§Exit codes

Generally the program will panic to exit. There is one exception to this rule - if a discussion post already exists, it will use COMMENTS_EXIST.

Structs§

HttpClients
Monostruct containing the HTML and GraphQL clients used to create the discussion, along with the necessary URLs.
Post
A representation of a typical blog post, used in creating the GitHub Discussion

Constants§

COMMENTS_EXIST
Exit code for when comments already exist (as in HTTP 303 See Other)

Functions§

create_discussion
Create the GitHub Discussion post for Giscus.