How this blog site is built?
This blog was created using Hexo, a fast and simple static site generator, and enhanced with the Butterfly theme. Here’s a step-by-step tutorial on how this site is built:
Chapter 1: Building a Hexo Blog Site
This chapter covers the process of setting up a blog using Hexo and the Butterfly theme.
1. Set up the environment
First, ensure you have Node.js installed on your system. Then, install Hexo globally via npm:
1 | npm install -g hexo-cli |
2. Create a new Hexo project
Create a new directory for your blog and initialize a Hexo project:
1 | hexo init my-blog |
3. Configure your site
Edit the _config.yml
file in the root directory to customize your site settings, such as title, author, and URL.
4. Install the Butterfly theme
Install the Butterfly theme and its dependencies:
1 | npm install hexo-theme-butterfly |
Then, modify your _config.yml
file to use the Butterfly theme:
1 | theme: butterfly |
5. Create content
Create new blog posts using the Hexo command:
1 | hexo new "How this blog site is built" |
Edit the generated Markdown file in the source/_posts
directory to add your content.
6. Generate and preview your site
Generate your static files and start a local server to preview your site:
1 | hexo generate |
Visit http://localhost:4000
in your browser to see your site.
That’s it! You now have a fully functional blog site built with Hexo and the Butterfly theme. Customize it further by exploring Hexo’s plugins and the Butterfly theme’s configuration options to make it truly your own.
Chapter 2: Adding Comments to Your Blog
This chapter covers the process of adding comments to your blog using Waline.
Waline is a simple, safe, and free comment system. Here’s how to add it to your blog:
1. Set up Waline Server
First, you need to set up a Waline server. You can deploy it on platforms like Vercel, Heroku, or your own server. Follow the official Waline documentation for detailed instructions.
2. Install Waline in your project
If you’re using npm, install Waline in your project:
1 | npm install @waline/client |
3. Using Waline in the theme
In the _config.butterfly.yml
file, add the following code to the comments
section:
1 | comments: |
4. Configure Waline settings
In your theme’s configuration file (e.g., _config.butterfly.yml
for the Butterfly theme), add Waline settings:
1 | waline: |
That’s it! You should now have Waline comments working on your blog. Remember to adjust the serverURL and other options to match your specific setup.
This tutorial will guide you through the process of deploying your website on Vercel and connecting it to the custom domain www.mol-science.com.
Chapter 3: Deploying Your Website on Vercel with a Custom Domain
This chapter covers the process of deploying your website on Vercel and connecting it to the custom domain www.mol-science.com.
1. Prepare Your Project
Ensure your project is ready for deployment:
- Your project should be in a Git repository (GitHub, GitLab, or Bitbucket).
- Make sure you have a
package.json
file with abuild
script defined.
2. Sign Up for Vercel
If you haven’t already, sign up for a Vercel account at https://vercel.com.
3. Connect Your Repository
- From the Vercel dashboard, click “Import Project”.
- Choose “From Git Repository” and select your Git provider.
- Authorize Vercel to access your repositories.
- Select the repository containing your website.
4. Configure Your Project
- Vercel will automatically detect your project settings.
- Verify the “Framework Preset” is correct (e.g., Next.js, Hexo, etc.).
- Adjust the “Build and Output Settings” if necessary.
- Click “Deploy” to start the deployment process.
5. Set Up Your Custom Domain
- Once deployed, go to your project settings in the Vercel dashboard.
- Navigate to the “Domains” section.
- Click “Add Domain” and enter “www.mol-science.com“.
- Vercel will provide you with DNS records to add to your domain registrar.
6. Configure Your Domain Registrar
- Log in to your domain registrar (where you purchased mol-science.com).
- Find the DNS management section.
- Add the DNS records provided by Vercel. Typically, this includes:
- An A record pointing to Vercel’s IP
- A CNAME record for the “www” subdomain
For example:
1 | A @ 76.76.21.21 |
7. Wait for DNS Propagation
DNS changes can take up to 48 hours to propagate, but often complete within a few hours.
8. SSL Certificate
Vercel automatically provisions an SSL certificate for your custom domain. Once the DNS propagation is complete, your site will be accessible via HTTPS.
9. Verify Deployment
- Visit https://www.mol-science.com in your browser.
- Ensure your website loads correctly and the SSL certificate is valid.
10. Set Up Automatic Deployments
Vercel automatically deploys your site when you push changes to your repository. To customize this:
- Go to your project settings in Vercel.
- Navigate to the “Git” section.
- Configure your preferred branches for Production, Preview, and Development environments.
Congratulations! Your website is now deployed on Vercel and accessible at www.mol-science.com. Any changes pushed to your repository will trigger automatic redeployments, keeping your site up-to-date.