Contents

How to set up a Hugo blog locally and on Vercel simultaneously

Contents

Advanced mathematics textbooks tend to skip over the obvious steps in proofs. Same in my article, I will skip over the basic steps, such as the installation and use of git and Hugo.

From scratch, installing Hugo, publishing to GitHub, and then configuring it on Vercel, you will encounter many strange errors along the way, which is a tedious and laborious process. It is easy to get discouraged and give up halfway after a few failures.

So, I took a shortcut.

Create hugo blog on Vercel

  1. Create a new project on Vercel and choose a Hugo template to deploy. The link is: https://vercel.com/new/templates/hugo/hugo
  2. During the Hugo deployment process, Vercel will ask you to fill in the address of your GitHub repo.
  3. Then Vercel will automatically create a repo on GitHub and complete the configuration on Vercel.

After completing the above steps, you have created a Hugo project on Vercel in the fastest way. The whole process doesn’t even need one minute.

Clone the hugo blog to local

If you want to create articles locally, preview them, and then publish them to GitHub and Vercel, what should you do?

  1. Install applications such as Git and Hugo locally.
  2. Git clone this Hugo project from your GitHub.
  3. Theoretically, you should be able to run the command hugo server in order to operate the project locally.

A clever way to bypass errors

However, I always encounter various strange errors, which are rather taxing to deal with. Therefore, I took another shortcut.

  1. Create a new Hugo project in another folder.
  2. Delete the content of the local folder for the GitHub project and copy the files of this new project to the GitHub project folder.
  3. Push to the project on GitHub. In this way, you have completed the construction of the local and remote Hugo project.

Now, all you need to do is create content locally, then publish it to GitHub, and the content will automatically update on Vercel within 1 minute.