Once you, like me some time ago, decide to create your personal blog page (with or without). There are many ways to achieve your plans, depending on your programming experience, the level of laziness, and the degree of crowning. But personally, it seems to me that starting a hosting and a domain and creating a serious “adult” site just to show itself as somehow too redundant. Because to achieve this goal, you can go more simple way - to make a static site.
Static sites are fast, secure, easy to publish and can be managed through a version control system. Jasper van der jeugt
I hope that it is not necessary to give evidence of what Jesper said, since everything is clear enough.
')
On that day, when I decided to make my personal page, I discovered that it is possible to place it on github. To publish, it will be enough to call
git push -u origin master from your repository, so everything should be quite simple. But for a start, we need to find some static site builder, to configure everything once, start up and then add new posts from time to time, information about projects, and what would you like there to do. Setting up the most popular
Jekyll solution on my Windows machine turned out to be somehow too problematic, so having a little browsing the Internet I found a great alternative -
Hakyll . And since my hands were itching a long time ago to try to do something on Haskell, I decided that it was worth trying. If you are interested in following in my footsteps, welcome.
Step 1. Installation.
A good start for us will be to have
Haskell Platform . After installation we get:
- Glasgow compiler is one of the most famous, if I'm not mistaken.
- Interactive environment - simultaneously in a console view and an application wrapped in WinGHC.
- Cabal is the package manager for Haskell. (Here I would like to note that in my modest presentation it is still a package manager, although other opinions on this subject can be read on the Internet).
It seems to me that if you haven't had experience with Haskell for this, you just need to run ghci and try what it is. An alternative way would be to try the first time on
tryhaskell .
If you want to study in more detail, I can recommend just the most wonderful book "
Educate yourself to Haskell in the Name of Good ." But I will tell you a little secret. You do not need to know Haskell in order to make your blog on Hakell. If you already have a certain programming experience and you even know what a version control system is (and I’m sure that you have it, you know), this will be more than enough to finish reading everything described below. I would even say that you would most likely use html and css skills to customize the appearance of the default site for your preferences, but more on that later.
Step 2. Get Hakyll
We are ready to be even closer to our goal, and cabal will help us in this. And a great idea would be to update it.
> cabal update > cabal install cabal-install
It will take some time for the package information to be updated and we are ready for the second magic team:
> cabal install hakyll
Done! Or not. In general, we should have received khakill after calling the mentioned command, but I personally received an error, that there were no directories, and other horrors. I unfortunately did not waste time on finding out in detail what the matter was, and just asked the all-knowing Google. He proposed to execute the last command in a slightly different form:
> cabal install --flags="-unixFilter" --constraint="directory installed" hakyll-XXXX
Instead of XXXX, there should naturally be a version of the package, see which one you can find
here : I dare to assume that the error could happen only because we use Windows with you, and some things are a little less meant for us than for other OSes.
Step 3. Initialize the site.
Despite the fact that these steps are fairly well described on the official page of the project, I will repeat here for integrity. The previous step was to reward us with the hakyll package, and therefore we open the location of our future great personal page on the console with you and do the following:
> hakyll-init our_amazing_personal_site > cd our_amazing_personal_site
Let's see what happened with us. And we got the following things:
- site.hs contains a Haskell code that will later be compiled into an executable file to give us the opportunity to build a site and run, for example, locally server to view this site
- index.html contains the content of our homepage.
- contact.markdown will be compiled into the “contacts” page
- about.rst will be compiled into the “about us” page
- templates daddy contains templates that will later help build various pages of the site.
- images quite obviously contains pictures
- posts contains sample posts in .markdown format
- css contains styles for our site
There is no doubt that you can change everything you want here, but before you do this, make sure that you know Haskell and studied the contents of the file site.hs. And of course now is the time to go and see what is contained in other files.
Now we compile the executable file:
> ghc --make site.hs > site build
You probably noticed that even more files appeared in the most favorite folder. Take a look at them:
- site.o , site.hi and site.exe product of compiling the site.hs file
- _site contains a compiled site ready to be opened in your favorite browser. Hooray! :)
- _cache will contain caches as we walk through our site locally.
If you put a hakill with a preview server, call:
> site preview
and rush to the
local host to see what happened with us. If your 8000 port is busy, then call:
> site server --port=5050
and try again to look at the
result .
Step 4. Publication.
I hope that you already have your account on github, well, or if not, then it's time to get one. In any case, after registration (or login), we create a repository with the following name:
[your github username] .github.com
Now we start gitBush we come into the _site daddy created by hakill and we do the following:
$ git init $ git add . $ git commit -m "my amazing personal page with hakyll init" $ git remote add origin [repository address github gently provided you with] $ git push -u origin master
Fuh ... We did it out :) Now visit your repository and make sure that the push was excellent. Well, finally, visit your new wonderful page, just typing in
your [your github username] .github.com browser !
Epilogue.
If you think that the article is at least a bit fit, write in a personal, well, or leave comments. Thank :)