[fastpages] Replacing main <username>.github.io Page w/ FastPages?

@hamelsmu I thought I’d ask this here since I imagine others will want to know as well. (And apologies if this is answered already elsewhere – In which case just point me to the answer!)

I’ve set up a new version of a fastpages blog at https://drscotthawley.github.io/devblog2/
whereas my “main” Jekyll-based development blog for a couple years has been at https://drscotthawley.github.io.

…And I think I’m satisfied enough that I’m ready for the fastpages version to take over at the main URL! Nice work!

So… What’s the best way to do that?
(i.e. I want the page at drscotthawley.github.io to be overwritten by fastpages.)

I ask because I see a comment in _config.yml about NOT choosing a url that’s just <username>.github.io.

Thanks!

2 Likes

oops sorry I thought this was a DM ( I need to sleep more ) I’ll answer shortly

Hi @drscotthawley!

Here is some background that will make my answer easier to understand. There are different kinds of GitHub pages. The two that you most often see are:

  1. User pages: This is when you name your repo username.github.io. A GitHub user can only have one user page. When you setup a user page by naming your repository in this special way your site is served at http(s)://<username>.github.io. Notice how there are now subpaths, like /blog at the end of your url. For a variety of reasons, fastpages does not support user pages. However, fastpages supports project pages.

  2. Project pages are when you name your repo like any other github project, like my_repo. in this case your site will be served at (unless you’re using a custom domain):
    http(s)://<username>.github.io/<repository> or http(s)://<organization>.github.io/<repository> (depending on if you setup the repo in your individual GitHub account or under an organization). this is what fastpages supports.

Now, your challenge is that you need to migrate your former user site to a project site. One solution to this could be to redirect folks from your old url to your new one. I haven’t tried this myself but I found this article while searching for this just now. https://dev.to/steveblue/setup-a-redirect-on-github-pages-1ok7

I hope this is helpful. Let us know how it goes.

8 Likes

Thanks for the explanation. I’m ok with doing a redirect. I’ll create a new branch on my old blog repo and implement the redirect.
Thanks.

Why isn’t it possible to make fastpages a user page?

Shouldn’t it be possible if the repository is named username.github.io?

It’s possible it just breaks the current automation. Perhaps will support that in the future. Had to pick one flavor to begin with and this one was a little easier to automate.

2 Likes

Thanks,
I implemented the redirection myself, I also wanted to make sure that all the old urls would work, so I modified the theme of the old website to redirect each page (I had the same relative url on the old and the new website):

<meta http-equiv="refresh" content="0; URL=https://zonca.dev/{{ article.url }}">
<link rel="canonical" href="https://zonca.dev/{{ article.url }}">

This is for Pelican, but something with a similar syntax should work on Jekyll as well.

3 Likes

Is it possible to have two gh-page sharing the same domain? I have been experimenting setting up fastpages as custom_domain/blog but with no luck yet.

My idea is my old page will be either custom_domain/home or custom_domain, and fastpages is under custom_domain/blog

Hello guys! My current URL is https://covid19graficos.github.io/relatorio but I would like to make the URL https://covid19graficos.github.io to work as well. Ideally I would like to remove the \relatorio from the original URL, however, @hamelsmu mentioned that the current automation will be broken. So, I assume that the best solution is to use redirects. I am very very beginner in web development. Can anyone suggest a reference or a video to help me creating this redirection idea? Probably the first step will be to create an organization page with the repository name covid19graficos.github.io. Then the next step would be to just create an index.html with the code that @zonca shared?

Thank you so much for creating this template! It makes my life so much easier to publish jupyter notebooks!

Please read this thread [fastpages] Replacing main <username>.github.io Page w/ FastPages?

Hey @hamelsmu! I think you probably mentioned https://dev.to/steveblue/setup-a-redirect-on-github-pages-1ok7 Thanks! I will take a look!

Reason not to use username .github.io - lack of automation. Maybe it good idea do all automation (convert nbs to md) on client side and than after push only deploy md to pages?

@a_yasyrev Did you manage to make it work by compiling locally and using username .github.io ?

@rohanrajpal .github.io will not work currently.

1 Like

@hamelsmu
Thanks, I did read this before. I dont mind breaking the automation, since I always compile locally before publising. So was just figuring out a way around, great project tho!

@hamelsmu Revisiting the question of redirects: :slight_smile: This FYI is optional for users who want/need to try.

It’s also possible to redirect individual pages, rather than the full blog:

Today I was able to get the plugin jekyll-redirect-from working, just by modifying _config.yml and Gemfile, and then adding the - redirect_to: <new_url> YAML front matter in my Jupyter notebook source on the ‘old’ blog, and the result is
that individual pages on my old Fastpages site like this page with the ‘devblog3’ in the url will now automatically redirect to the corresponding pages in the new blog with ‘devblog3’ suddenly changing to ‘blog’ in the URL.

(I did this because ‘devblog3’ was supposed to be temporary, but thanks to Jeremy & others a few of my posts there got shared around and some people still refer back to them, so I didn’t want to delete the links. Now everything goes to ‘blog’.)

1 Like

I made a post on my experience here, but the problem was I had two blogs one that was sitting on the .github.io and then the new fastpages site at /dl-blog. To complicate matters I had already set up the custom domain name on the old site.
The easiest thing is a redirect or in my definition a forwarder. You create an index.html file in the .github.io directory and repoint it to where your fastpages repo (which should be /something) in my case it was /dl-blog.

<meta http-equiv="refresh" content="0; URL=https://yourdomainname.com/dl-blog">

Somehow I screwed up with so many parameters in the _config.yml and after hours of troubleshooting it, just cloned a new repo, copied all the content over, renamed the forwarder and everything was working.
Something that warned me of not doing too much custom stuff is that when things change from fastpages for an upgrade, it may not be as smooth as you would like.
Anyway, just my 2 cents.

If you’re going to use a redirect (which I also do) you should note that it’s safer to include a link in case the client doesn’t behave itself and redirect as expected. It shouldn’t really happen but it can.

<!DOCTYPE HTML>                                                                
<html lang="en">                                                                
    <head>                                                                      
        <meta charset="utf-8">
        <meta http-equiv="refresh" content="0;url=https://joedockrill.github.io/blog/" />      
        <link rel="canonical" href="https://joedockrill.github.io/blog/" />                    
    </head>                                                                                                                                                                  
    <body>                                                                      
        <h1>                                                                    
            This page has been moved to <a href="https://joedockrill.github.io/blog/">joedockrill.github.io/blog/</a>
        </h1>                                                                  
    </body>                                                                    
</html>

This is better as an index.md.

Normally, now it should be possible to use fastpages for GitHub Pages user/organization sites. I have created a Pull Request to adapt the setup workflow for these cases. Once it will be accepted and merged, it will be official! :wink:

2 Likes

is this currently supported? it appears not. Ok, the site actually builds, but the Check Configuration fails.