Note: Later I will need to use Travis CI to automatically deploy the website after each commit, so you might also need to check which platforms they support for deployment. But feel free to use other services to host your static site. Since I commit my code to GitHub, I prefer to host my site using GitHub Pages. There are plenty of options to host your site for free, but I prefer to put both source code and production code in a single place. Now, open localhost:8000 in your browser and you should see the generated blog in your browser. $ yarn global add gatsby-cli $ gatsby new gatsby-blog $ cd gatsby-blog $ gatsby develop For this tutorial, I will be using yarn but feel free to use npm.įirst, install gatsby-cli and create a new repo using Gatsby's official blog starter. I assume you are already a JavaScript developer and know some basics of npm, yarn, and continuous integration. This post will not focus on that, but I will still show some basic steps to get your blog up and running. There are plenty of tutorials on how to setup a blog using Gatsby that discuss all the powerful features Gatsby provides. Bonus: How to write a blog on your phone.Seting up Travis for automatic deployment.Setting up Github Pages to host your blog.I’ve divided this post into five sections: And I will also share how to edit the blog on your phone. All you need to do is to commit and push your code. In my setup with Travis CI, git push is the new "Publish" button. After trying and researching different setups, I am pretty happy with the result. I always believe that the easier it is to write and publish your blog, the more you will write. Writing using a static site generator does not need to be difficult. But how can I make writing in Gatsby as easy as writing on Medium? That is when you hope you have written everything in Markdown and have a site hosting those Markdown files. But there is something Medium or Wordpress cannot provide: the more you write, the more you want to keep your writings in a secure place, in a simple format, just like you might keep your diary books for years.īut imagine that one day you want to migrate everything you wrote from Medium to somewhere else. I guess this is why people eventually give up writing using a static site generator and write on Medium instead. Why should you write on Gatsby instead of public platforms? You will end up spending much more time doing unimportant things other than the actual writing. If anything goes wrong, you might have to repeat some of the steps and wait a few minutes until the blog online is what you want. On the other hand, if you write a blog in static site generator, you will need to remember all the scripts, preview the blog on localhost, build the blog for production, commit and push your changes to GitHub, and deploy your site to the public. Everything is done, your blog is live, and you can reach your audience right away. Once you’ve finished writing, you just need to click the “Publish” button. If you write in public platforms, you can write on a laptop, and edit on your phone. There are lots of advantages to writing on public platforms like Medium over static site generators. There are two kinds of people: people who write on platforms like Medium and people who code the blog themselves using static site generators. The Issue Why do people love to write on platforms like Medium rather than using static site generator? Gatsby is a blazing fast static site generator based on React. Recently, I decided to migrate my blog to Gatsby. By Hu Chen How to use Gatsby to create your blog and work on it from your phone Image by Jesus Kiteque
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |