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

48,479

Solution 1

This website gives a good answer on how to do this: https://www.hywel.me/static/site/wordpress/2016/07/17/fast-free-static-website-with-wordpress-and-github-pages.html

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!

Solution 2

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. https://github.com/jekyll/jekyll

Solution 3

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: https://wordpress.org/plugins/static-html-output-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.

Solution 4

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:

Solution 5

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

You will find migration documentation on the jekyll site.

Share:
48,479
Admin
Author by

Admin

Updated on May 24, 2021

Comments

  • Admin
    Admin about 3 years

    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?

  • Johan Palmfjord
    Johan Palmfjord over 8 years
    PS. You could use a tool to grab all source code for each page (SiteSucker for OS X is really good if you're on a mac) and then do a multi-file search and replace to swap all links to your github address. Not too much manual work really :)
  • Edward
    Edward about 7 years
    How is the content updated in this setup? Can users go to the admin page or will they need to clone the repo to their local machine, update the content , then push to origin?
  • Christoph
    Christoph about 7 years
    You just need to install the WordPress plugin either locally (free) or on a server. Next you let it generate a zip files with all static files. Unzip it, commit it to git and push to the appropriate GitHub branch. works as expected if you follow the guide.Keep in mind that dynamic non JavaScript stuff like search will stop working. If you want to update do your updates in the WordPress install and just do another export and repeat the steps.you can just overwrite the old files and git detects the changes.
  • Edward
    Edward almost 7 years
    Yes, but I'm talking about a system where a user can only use a wysiwyg. They aren't going to set up a local wordpress install and set up git.
  • Christoph
    Christoph almost 7 years
    If you install wordpress on a server you can maybe create a bashscript and a chronjob to automatically unarchive the export, replace the folder and commit and push to git. That way you can say it syncs every hour(?) and they don't need to setup anything.
  • Edward
    Edward almost 7 years
    Simply Static doesn't support chron jobs, though. Do you have an example/docs on this bashscript? I'm not a backend person so I'd need the steps on how to do this. Anything short of that is just rest of the f-ing owl to me
  • Christoph
    Christoph almost 7 years
    Can't really help you with that since the script would be dependant on your server environment. If you don't have any bash/backend knowledge I wouldn't recommend going this route. Why does your client want a static wordpress? Maybe it's easier to just install a decent caching plugin for getting proper site speed.
  • ljs.dev
    ljs.dev about 6 years
    For the top-voted answer, this is quite misleading. As the author of the WP plugin linked in the other answer here, both it and another popular WP to static HTML export plugin exist to do just that. My plugin will also automate the deploy to services including GitHub Pages, so it's a one-click process, much easier than using SiteSucker, HTTrack or such to manual crawl and then push to GH: wordpress.org/plugins/static-html-output-plugin