rocky-linux / rockylinux.org-gatsby

The official website of the Rocky Linux project.
https://rockylinux.org
BSD 3-Clause "New" or "Revised" License
177 stars 75 forks source link

Recent activity section(s) on homepage #400

Open brianclemens opened 2 years ago

brianclemens commented 2 years ago

In addition to the current recent announcement posts, we should display recent activity on homepage such as "recently popular Discourse threads", "recent Twitter posts", etc.

FoggyMtnDrifter commented 2 years ago

While I love the idea, I'm not sure it's going to work well with Gatsby, which at its core is a static site generator. I'll take a look this weekend and see what the limitations might be and, if achievable, the best way to go about it.

hbjydev commented 2 years ago

@ressonix I'm thinking we could just have a section that lazy loads with a Discourse API. Definitely possible with Twitter, obviously, but just something like:

const loading = useState(true);
const discourseReq = await fetch('https://forums.rockylinux.org/posts.json');
const discourse = await discourseReq.json();

return (
  <h1>Recent Activity</h1>
  { loading ? <p>Loading...</p> : <p>Found {discourse['latest_posts'].length}.</p> }
);

There's no reason we'd care about it being included in SEO imo

hbjydev commented 2 years ago

https://docs.discourse.org/#tag/Posts/operation/listPosts <- source of Discourse API docs btw