Get started with 33% off your first certification using code: 33OFFNEW

How to build a basic website in VuePress

3 min read
Published on 29th March 2024

VuePress combines the simplicity of a static site generator with the power of Vue.js, offering developers and content creators a platform to build high-performance, SEO-friendly websites with minimal effort. Whether you're documenting a project, creating a blog, or building a small business site, VuePress provides the tools necessary to get your website up and running quickly. This article will walk you through the process of creating a basic website using VuePress.

Step 1: Setting Up Your Environment

Before diving into VuePress, ensure you have Node.js (version 8.6 or later) and npm installed on your computer. These are essential for running VuePress and managing its packages.

  1. Install Node.js and npm: Visit Node.js's website to download and install the latest version. npm is included with Node.js.

  2. Verify Installation: Open your terminal or command prompt and run the following commands to check if Node.js and npm are correctly installed.

node -v
npm -v

Step 2: Creating Your VuePress Project

With your environment set up, you're ready to create your VuePress project.

  1. Create a New Directory: This directory will hold your VuePress project. Use the terminal to create and navigate into your new directory:
mkdir my-vuepress-site
cd my-vuepress-site
  1. Initialize a New npm Project: Run the following command to create a package.json file in your project directory. This file tracks your project dependencies and scripts.
npm init -y
  1. Install VuePress Locally: Install VuePress within your project directory as a local dependency. This approach is recommended for project-specific installations, ensuring compatibility and ease of deployment.
npm install -D vuepress

Step 3: Creating Your First Page

VuePress generates your site based on the content of Markdown files. Let’s create your first page.

  1. Create the Documents Folder: VuePress requires a specific folder structure, with the default content living within /docs.
mkdir docs
  1. Write Your First Markdown File: Navigate to the /docs directory and create an file. This file serves as the homepage of your VuePress site.
# Hello VuePress

Welcome to my first VuePress site.

Step 4: Configuring Your Site

Customize your VuePress site by editing the .vuepress/config.js file, which may need to be created if it doesn't already exist.

  1. Create the Config Directory and File: Inside the /docs directory, create a new folder named .vuepress, and within that, a file named config.js.
mkdir docs/.vuepress
cd docs/.vuepress
touch config.js
  1. Edit the Configuration File: Open config.js in your text editor and add your site configuration.
module.exports = {
    title: 'My VuePress Site',
    description: 'Just playing around with VuePress',

Step 5: Running Your VuePress Site Locally

To preview your site, run VuePress in development mode. This command starts a local server with hot reloading.

npx vuepress dev docs

Visit http://localhost:8080 in your browser to see your VuePress site in action.

Step 6: Building and Deploying Your Site

When you're ready to publish your site, build the static files.

npx vuepress build docs

VuePress generates your site in .vuepress/dist, which you can deploy to any static site hosting service like Netlify, Vercel, or GitHub Pages.


Creating a basic website with VuePress is straightforward, thanks to its simple setup process and the power of Vue.js. By following these steps, you've learned how to set up a VuePress project, create content, customize your site configuration, and prepare your site for deployment. Whether you're building a personal blog, documentation, or a small business site, VuePress offers a solid foundation to quickly bring your project to life. Continue exploring VuePress's features and plugins to further enhance your site and tailor it to your needs.