Can I host my wordpress blog on github pages as a static webpage

I would like to make my WordPress blog installed on Localhost to push into GitHub and run that on GitHub as a static page. Can I do it, and if yes please give me a detailed answer with the steps and problems involved?

I don't care if my page is static, but will I be able to host it on GitHub pages?

6 Answers

This website gives a good answer on how to do this:

In short:

  1. Set-up GitHub pages.
  2. Install Simply static plugin into WordPress.
  3. Push the export from the plug-in back to your git repository and you are done!
6

You can't. You would use WordPress if you want a dynamic page - that is the whole point of using it. You could of course grab the html generated by WordPress and push that to your GitHub, but that I think that would be a lot of manual work.

You could try a static page generator, i.e.

2

If you absolutely can't switch from wordpress, but absolutely need to host on github pages, then your only option is probably to look into some wordpress plugin that will take your entire site and spit out a static website (sort of like jekyll, but for wordpress specifically).

edit: There actually is such a plugin:

I just tested it out on a brand new WP installation and it seems to work alright, but a few things seem not to work.

0

Unfortunately, and simply you can't do this as WordPress is a WebApp, that is, requires a database. Sorry to be the bringer of bad news.

If you are considering an alternative, consider the following static site generators which can be hosted from GitHub Pages:

0

You can migrate fromwordpress to jekyll static site generator, the one powering github pages.

You will find migration documentation on the jekyll site.

No, for that you would need:

  • Go to Github, create a new repository with this convention: .github.io.
    For clarity sake, my repo would be andy4thehuynh.github.io.
  • Also, create a local instance of a hugo repo.
    Cd into an empty directory on your local machine and execute hugo new site ./.
    Initialize a git repo with git init and add your remote git remote add origin :<your_handle>/<your_handle>.github.io.git.
    Cool, we have a fresh blog repo.
  • Let’s add a test post; execute hugo new post/test.md and echo 'Your live on Github Pages' >> ./content/post/test.md.
    Set the draft flag to true to make sure your post renders.
  • Tell Hugo to build your site by running hugo.
    Your public directory should be populated with a freshly generated site. Awesome!
  • Here comes the sauce; perform a echo 'public' >> .gitignore. Now, Git will have no idea of your public directory (your compiled public content users will view in a browser). You’ll see why quickly.
  • Switch out of the master branch with git checkout -b source. We do this since GH pages doesn’t care about our source code (aka our source branch). It only cares about the public content.
  • Add and commit your source changes. Do a git add -A and git commit -m 'Initial Commit'. Push your changes with git push origin source.
  • Lastly, cd into your public folder. Notice Git is not keeping track of changes here. This was for intended purposes. Do a git init, git add -A and git commit -m 'Initial commit'. Push your changes with git push origin master.

Open a browser to your repo named .github.io and switch between your source and master branches.
All your compiled content should be in your master branch.
GH pages will see that and render it at <your_handle>.github.io.
You’ll write your drafts in your source branch. Compile it with the hugo command. When your happy with your compiled changes, push your public folder and become a rock star.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like