I am trying to add some external URLs (the URLs that are under my username.github.io domain but not in the project by themself because of how GitHub handle the project-based webpages) to my sitemap.xml that has been generated by - jekyll-sitemap plugin and I couldn’t find the correct way to do it.
Is that any working solution to realize that?
Thank you.
The simplest way to handle this might be to create a blank page that redirects the user to the “external” content using the html http-equiv
meta tag.
Redirects will be okay provided you do not cross domains. i.e. username.github.io/abc
to http://username.github.io/xyz
is fine.
I have a hack in my Jekyll site to build a sitemap that contains the homepages of almost all my GH Pages sites.
How it works
The site itself is just a one-page site.
So line 8 handles that and gives this result:
<url>
<loc>https://michaelcurrin.github.io</loc>
<lastmod>2021-12-20T12:07:43+00:00</lastmod>
</url>
Other sites are rendered like this:
<url>
<loc>https://michaelcurrin.github.io/auto-tag/</loc>
<lastmod>2021-12-20T12:07:43+00:00</lastmod>
</url>
<url>
<loc>https://michaelcurrin.github.io/badge-generator/</loc>
<lastmod>2021-12-20T12:07:43+00:00</lastmod>
</url>
Based on a manually-maintained data file of all my sites.
There is some duplication in here of course - one just needs the name
field and the url
from the config to infer the full URL, but anywhere it works.
I think I got the data from a GH API GraphQL query to look up all my sites and their URL. Let me know if you want that query.