In this project, we provide all the code you need for a personal website with a homepage, information pages, and navigation. Let's see how to set up Prismic to get this up and running.
1. Launch the project
First, Install the prismic-cli package. Launch a terminal instance and run the following command to install the package globally.
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
Once it's been installed, navigate where you want to create your new project folder and run the following command:
prismic theme --theme-url https://github.com/prismicio/nodejs-multi-language-site --conf config/prismic-configuration.js
This will create a new Prismic content repository, set up the custom types, create a few documents, and install the project code
2. Multi-language configuration
For this example project, you'll have a default locale configuration on your repo. This will be:
en-gbas the master locale
- And, French
fr-fras the second locale
And, if you want to add additional locales, go to your Dashboard, enter your repository, go to Settings / Translations & locales and add another language.
🌐 Change the master locale
If you wish to modify the master locale of your repository, reach out to us so we can make this change for you.
If you add a new master locale, update your language settings in the 'config' folder of the project. open the 'site-config.js' file and replace the
defaultLanguage with the master language of your repository.
3. Run the website
Now, open your project folder in the terminal and run the following command:
npm install -g nodemon
Then this next command will launch a local development server at http://localhost:3000.
Now all of your content is displayed!
4. Deploy & go live!
An easy way to deploy your Node.js application is to use Heroku. Just follow these few simple steps once you have successfully signed up and installed the Heroku toolbelt. Create a file with the name Procfile file at your application root. Put the following code in the Procfile file:
web: node app.js
Create a new Heroku application
Initialize a new Git repository
heroku git:remote -a your-heroku-app-name
Commit your code to the Git repository and deploy it to Heroku
git add .
git commit -am "make it better"
git push heroku master
Ensure you have at least one node running
heroku ps:scale web=1
You can now browse your application online.
Customize to your likings
Click on the links in the navigation to see all your pages. Now can easily modify this example site to create your website: edit the stylesheets and templates to fit your design.