I have two repositories. One is my github page (https://github.com/roneydua/roneydua.github.io) and the other is a repository that I want to show docs / index.md as a post on my Github page (https: // github .com / roneydua / PlataformaStrapdown - link to the repo that I can show on my website).
I want a way to attach https://github.com/roneydua/platformStrapdown/blob/master/docs/index.md to a post and keep the post form.
I created a post with permalink like this:
permalink: / PlataformaStrapdown /
The link works, but it doesn’t have a posting form.
If anyone has a solution I will thank
By post form and attach, do you mean you want to embed the content of a page on the one repo on the other repo so it styles the same and the user doesn’t have to click on a link?
Hi @MichaelCurrin, Thanks for reply,
A link with it is a way that show the GitHub Readme.md on my site, but I want literally concatenate a file .md on my post, something like :
Like add a file.tex on a file2.tex on latex texts
I’m not have experience with websites. My point of view it is, that if I link this way, when I update a readme.md file on my repo, my website it is auto update.
I don’t think there is a common way to do what you want in Jekyll.
You could take the plugin approach where you find or write a Jekyll Ruby plugin that can take content from another repo and use it.
Take the jekyll-gist plugin for inspiration. It takes a gist ID and will both create a script tag and also embed the actual content on the page for SEO reasons.
Instead of getting a gist of say markdown, you could adapt it to get the raw content of a markdown page on a GitHub repo.
But updating the external page won’t trigger a build on the other repo unless you build on a schedule or use hooks or some trigger for a build.
Or you can just JavaScipt to lookup the page and insert content. That will always show the latest content.
Or you use a submodule approach. In your top level repo, you can add the external repo as a submodule. It is similar to cloning but it works better for when you want to put one repo inside the other using one reference without all the commits
Once you have one repo inside the other, you can use a symbolic link to get the content to where you want it to.
You can then use the content of the external repo in your top repo, as if the files were in the same repo.
But I have a feeling you are going to get frustrated with setting up, using and updating a submodule if you haven’t used it before. Plus you’ll still have to use a hook or a make a manual change to ensure the external repo change force the other repo to update and rebuild
I would see if there is a way you can achieve your goal without embedding content. For example, does your markdown file really have to appear in two repos and two sites? Maybe you should just move the file out of one repo into the other to avoid your problem.
If there are enough files you want to move or reuse, maybe you can merge your two repos into one and just make one site. If really still want to duplicate the page on two paths, you can do a symlink within the repo
Or go back to just linking to the page.
One other suggestion.
You can actually just duplicate the .md file in two repos.
In the top repo, you can have a shell command which fetches the external pages with curl or wget and if there are changes then it commits them. You can run this on each build so you’ll always have the latest content there. Again you’ll need a hook or a schedule.
You’ll just to make sure you only update the post in the external repo and not the top one, to avoid conflicts and content drifting.
Also note that using a plugin or shell commands will not work on GH Pages unless you use GH Actions. Or use Netlify.
I am very grateful for your explanations dear @MichaelCurrin .
I think the simplest way is to duplicate the file. And then add a header yourself. Create a symbolic link. I think ok.
As I started with Jekyll, I want to be careful to work clearly.