How I deployed my portfolio
1. Introduction
Hi, this a simple note to remember how i deployed my personal portfolio.
2. Why I chose this solution
I decided to develop my personal portfolio using GatsbyJs mainly for these reasons:
- Hosting is very cheap (completely free on Github)
- The website is static and that means that is very fast compared with websites developed with CMS like wordpress
- I found a very good documentation on the official websites
- I loved that template as soon as I saw it
3. Let's prepare everything
To be as clear as possible I decided to write an ordered list.
- Download GIT from here
- Download Nodejs here
- Install GIT
- Install Nodejs
- Create a folder where you prefer
- Right Clik and select
GIT Bash Here - Find your favourite template on the official website and save the url written under the picture of the project
- Create e new public repository in Github following this path
<yourUsername>.github.ioand copy the url of the project - Follow these commands in order
4. Follow these simple commands
-
gatsby new <nomeProgetto> <urlDelTemplateScelto>This will create a folder named
nomeProgettowith a lot of files needed for your websites -
cd <nomeProgetto>Remember to changewith the name of the project that you have chosen before This will change the working directory of the program
git remote remove origingenerally is not neded but anyway to prevent problems launch it-
git remote add origin <urlOfYourGithubProject>This command is very important because it will connect your local website with the cloud. Check that the url is right typing
git remote -v git branch -m develop
With this command we are creating a branch to store our "developing" files, in the other branch there will be the website
git push -u origin developWith this command we are going to save our building filenpm install gh-pages --save-devThis is the command used to install the plugin that will "send" your website to github cloud- Now we need to edit the file named
package.jsonadding this line inside of the group scripts. At the end you will have something like this
{
[...other code...]
"scripts": {
"deploy": "gatsby build && gh-pages -d public -b master"
[...other code...]
}
[...other code...]
}npm run deployto send your website in the cloud
#5. Other useful commands Remember to open GIT bash directly in the folder of your project
gatsby developto check in real time the changes running your website on a local server, after editing never forget to run-
npm run deployto send the new version of your website in the cloud@