This tutorial shows how to put into place a personal website using pillar, and automatically deploy it using github pages and travis.
This tutorial requires the development version of pillar that can be found in the feature/server-command
branch.
Clone pillar, check out that branch and then proceed with a normal pillar installation, as displayed in figure 1:
For the following sections, we need to have a GitHub account. So check here if you do not have a GitHub account.
Now we are going to create a repository on GitHub for our website. In this part, we are considering two different cases:
For both cases, GitHub provides you a service named GitHub Pages which allows you to host free your website. But especially for the second case, you need to have a personal website (by following first case), before hosting another project on your GitHub account.
Both in these cases, creating the repository on GitHub is the same.
For that, we need to follow these steps:
Your GitHub repository is now created and look like that.
After the installation, we can proceed to create a new site in a fresh directory.
We will install the academic
archetype and then run a local server.
This should work out of the box in your local machine, however, you will need to change the baseurl
setting in the pillar.conf
file to correctly render in github pages.
Then we will have a skeleton site available on localhost:8080
.
If you want to change the port, you can use the -p
parameter as in:
After these steps, you will get a default website as:
We are going fisrt to customize your profile in pillar.conf
file.
This is the default profile of academic archetype. So, you can set your name, choose an avatar, your post, ...
For the naviguation bar of the site, it is managed by a toc.pillar
file located at the root of the repository.
This is only used to generate the menu by specifying files of your project having at least one heading 1 level title. The toc.html
is not used.
Important : Each Pillar has to contain only one H1 title. Indeed this title is automatically taken as the title of the menu representing this page. So all other titles of your page have to be subtitles of the first one. You can define H2 or H3 titles.
Let's create a new page and add it as menu to the navbar.
We can choose to manage Teaching activities of a research professor.
Create teaching.pillar
file at the root of your project directory with contents:
After this we have to add a new entry in toc.pillar
. This will allow us to have Teaching as
a new menu in the naviguation bar.
We can notice that toc.pillar
is the file used to declare different menus.
Now you should get a page like that:
We have not cover all the syntax of Pillar here. So for more, you can click here.
If you want to host your site on GitHub, GitHub provides a free subdomain for their users.
So if you already have a GitHub account named myAccount
you can have a site for your project myProject
into http://myAccount.github.io/myProject.
We can already generate our pillar website automatically by calling pillar, and we can now also deploy our website in GitHub pages using travis.
Travis is a continuous integration service that will execute several scripts every time a new commit/branch/pull request is pushed into our repository.
This way, on every commit we can build our site and push our html to our website.
Automatic building and hosting of our website is using Travis Continuous Integration. So let's launch to Travis via our GitHub account following this.
We can now activate our GitHub repository in Travis:
This will automatically add travis as a service in your GitHub repository.
As for creating our GitHub repository, we are going to consider the two different cases
Now we install travis scripts in our directory.
.travis.yml
file in the root of your site with the following contentThis script globally download Pillar, build the site from pillar files pushed on source branch and push generated files (located in _result/html) on master GitHub branch. It means we should create master and source branch and only push to source branch.
We are now going to generate a token on Github and add it as an environement variable named GH_TOKEN
in Travis
On your project Settings in Travis, you have a menu labelled Environment variables where you can add variables (those variables will be automatically encrypted).
After all of that, you can commit your changes to GitHub and wait for your website on: https://myAccount.github.io/
Now we install travis scripts in our directory.
.travis.yml
file in the root of your site with the following contentThis script globally download Pillar, build the site from pillar files pushed on master branch and push generated files (located in _result/html) on gh-pages GitHub branch. It means we should have a default master branch. gh-pages branch will be automatically created by Travis job.
As in the previous case, we are going to generate a token on Github and add it as an environement variable named GH_TOKEN
in Travis
In this case, we must change a bite the configuration. So in pillar.conf
file, change the baseurl:
This will make urls start from your project, instead of from your account.
After that, you can commit your changes to GitHub and wait for your website on: https://myAccount.github.io/myProject
You can now enjoy the continuous integration. Every time you modify a Pillar, commit it on github and you will see your website automatically updated.