I agree with @ashmaroli that Jekyll was not specifically built for these scenarios and even though you can create themes and custom plugins, those tools are all in service of compiling your code into a static website.
Let’s take a look at how Jekyll works to create a post by hand:
- Go to (or create) Jekyll’s
_posts
folder and create a file
- The file looks something like this
/_posts/2022-11-04-my-first-post
---
title: My First Post
date: 2022-11-04
layout: post
---
Hello world!
- Whether manually or automatically (like with GitHub Pages), Jekyll builds your site, noticing the yaml front matter between the
---
's and then displays a static HTML web page that displays your content Hello world
.
In your case, you want some solution to automatically create that content for you. Specifically, you want to aggregate your content, which I suppose might mean you want to collect posts you made on social media, Medium, or whatever other sites you contribute to, is that correct?
Since Jekyll is not designed for this scenario, I do agree with @ashmaroli that you would want to create a separate repo(s) to do the aggregation for you.
I am willing to bet someone has already written code that would get you where you want to go in terms of getting, say, getting your posts from Medium (perhaps that is something as simple as a feed reader?).
At a high level, this is how you would create such a solution on GitHub (since that is what I know best):
- Create a Jekyll repo called
my-website
- Create a repo called
create-jekyll-content
. Since you want the create
repo to talk to the my-website
repo, I believe the most common way to do that is with secrets
- Create one (or many) GitHub Actions in the
create
repo. Those actions can run dockers containers which then run your custom code, which technically can contain any code you want. That code can (with more secrets) read APIs from other websites. I mentioned Medium earlier, so you can use their API to pull your latest post.
Note: GitHub Actions can run based on a schedule, specifically, a CRON job as @ashmaroli points out or you can manually execute the code at your whim, or it can be based on various GitHub events.
- Your code would take the content, create a filename based on Jekyll’s required post filename and content structure
- You code would then copy the file from the
create
repo into the my-website
repo, specifically into the /_posts
folder. If you are using standard GitHub Pages, the website will update automatically and your new content will be on your website in a matter of minutes
By the way, there is a whole GitHub marketplace full of Actions other people built, so even if you want to build your own, you might want to play with those to see how they work. For example, I found this action that will copy files from one repo to another.
The nice thing about GitHub Actions (as of this writing), is that they are free for everyone, but there are limitations, so as long as your code is not bulky and taking up too much processing time, you should be good.
Hope this helps!