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?
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:
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
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.
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:
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:
It might not address your wordpress aspect of the question, but can help other wanting to publish static pages on GitHub.
(And yes, you can migrate from wordpress to Hugo, plus there is an pending request)
Yes you can and it’s extremely easy. Benefits:
Steps:
Bonus:
Use wp-rocket optimizations. When the static site is created it will benefit from those.
As there is no databases, plugin forms ninja Forms will not work so use the ones accepted by the simply static plugin or third party like Typeform or google forms.
For security purpose configure your server to only accept you IP connection to static.mydomain.com this will increase your security and avoid google from indexing this subdomain.