Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 #4

Open
moul opened this issue Aug 14, 2019 · 6 comments

Comments

@moul
Copy link
Owner

commented Aug 14, 2019

Thinking about the V2, here are the ideas I would love to see in the V2:

  • add a way of generating static content periodically
    • only use ajax to get latest changes (or disable ajax completely)
  • add a github webhook in lambda that triggers a rebuild
  • create an anonymous user (or use @moul-bot) + create a lambda that allows posting anonymously
  • multi-platform (GitHub + something else)
@cdeleeuwe

This comment has been minimized.

Copy link

commented Aug 15, 2019

To use Github for comments and statically generate them on build, I think we could run a Lambda periodically or trigger it on each new comment. The only thing the Lambda does, is trigger a rebuild in Netlify.

Then in the website's pre-build, run a script that does basically the following:

  1. Fetch all issues from comments repo (could actually also fetch data from other sources, as long the data structure is known)
  2. Save the comments as JSON files in the Hugo's "data" folder

Then when Hugo builds, it can statically include the comments in each post.

Another option I found is https://jamstack-comments.netlify.com/about/. It doesn't use GitHub, but provides a way to comment directly on the website, and uses Netlify forms and Slack for moderation.
In order for this to work with AMP, we would need to use an iFrame for the form, since there is no Netlify API to submit forms programatically through a Lambda for example.

@moul, let me know what do you think?

@moul

This comment has been minimized.

Copy link
Owner Author

commented Aug 16, 2019

Thank you for this analysis

I like this approach yes, I think I will go with something equivalent progressively:

  • first, I will make the lambda webhook that triggers a new build with a script that fetches the latest comments
  • then, I will think about adding a form directly on the page using netlify forms
  • and finally I will add non-GitHub comments
@cdeleeuwe

This comment has been minimized.

Copy link

commented Aug 16, 2019

Sounds good. If I can help with anything, let me know :).

@cdeleeuwe

This comment has been minimized.

Copy link

commented Aug 18, 2019

Just saw that Hugo has a feature that can fetch JSON from a REST API during build. See https://gohugo.io/templates/data-templates/#data-driven-content. This might be another option, although I am not sure how it handles errors. Will try it out and let you know.

@cdeleeuwe

This comment has been minimized.

Copy link

commented Aug 19, 2019

@moul, just to let you know, I made a small test repo at https://github.com/cdeleeuwe/hugo-ghissue-comments.

I run into the 60 per hour GitHub API limit, but works fine so far using authenticated requests :)

@moul

This comment has been minimized.

Copy link
Owner Author

commented Aug 19, 2019

okay thx for the feedback 👍

@moul moul added this to the V2 milestone Aug 21, 2019

@moul moul pinned this issue Aug 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.