Want to see an example of a multi-page Vue website using Prismic? Look no further! In this project, we provide all the code you need for a personal website with a homepage, information pages, and a navigation. Let's see how to set up Prismic to get this up and running.

 
As mentioned above, we provide you with all the source code you need to get this example website working.

Install the Prismic Command Line Tool

To get started with your website, install the command line tool. It allows you to quickly start JavaScript projects that access your Prismic backend.

If you don't already have it, make sure to first install npm on your machine.

Fire up a terminal (command prompt or similar on Windows) and run the following command.

npm install -g prismic-cli

Sometimes it's possible that this command doesn't work. If that's the case for you, try executing a sudo command:

sudo npm install -g prismic-cli

The Prismic command is now available globally. We will now use that tool to launch this tutorial project. In the terminal, navigate to the location you want to launch your project and run the following command.

prismic theme https://github.com/prismicio/vuejs-website.git --conf public/index.html

The prismic theme command will initialize a Vue.js project that is configured to connect with the repository you just created!

The command will end by displaying a link to your content repository backend in the form of https://your-repo-name.prismic.io.

Write some content

Start by creating three pages: a homepage and two regular pages.

Go to Content, hit New, and select the Homepage type. Fill in the content for the homepage banner, then add slices to add the page content.

Save and publish!

Now, create two information pages. Go to Content, hit New, and select the Page type. Make sure to fill the mandatory UID field that is used for that page's URL. Add some content slices, then save and publish!
 

Fill in the menu

Let’s fill in the menu with your pages.

Go to Content, hit New, and choose the Menu type. Give the menu a title, and add all your pages.

For each page you want to add to the navigation bar: 

  1. Add a Link Label 
  2. Click on Link, then “What kind of link do you want to insert?,” select “Link to a Document,” and select the appropriate page.

Save and publish!

 

Run the app

Go back to terminal (command prompt or similar on Windows), point it to your project location (cd your-project-folder) and run!

npm install
npm run serve  

This will launch a local development server at http://localhost:8080.

 

Deploy & go live!

An easy way to deploy your Vue.js application is to use Netlify. Just follow these few simple steps :

First create a new Git repository with GitHub, Git Lab or Bitbucket and initialise this new repo:

$ git init
$ git remote add <shortname> <url>

Commit and Push your code to the Git repository

$ git add .
$ git commit -m "Initial commit"
$ git push <shortname> master

Then create a Netlify account and connect your Github.

After you've done this add your build settings:

Branch deploy: Master
Build command: npm run build
Publish directory: dist

And that's it deploy your website and your live.

 

Customize to your liking

You can now edit the stylesheets and the templates to fit your design! Also you learn more about querying and templating new changes you make to your custom types and documents in our Vue documentation.

Just curious about the code?

If you aren't interested in recreating this project and would just like to look at the code then you can download the project here.

Did this answer your question?