francescomecca.eu/output/blog/2016/4/2/blog-migrated/index.html
Francesco Mecca 6acba75cd5 wine article
2024-02-28 14:38:55 +01:00

107 lines
7.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>How I migrated to a static blog | Caught in the Net</title>
<link rel="stylesheet" href="../../../../../assets/blog/fonts/opensans.css">
<link href="../../../../../assets/blog/css/normalize.css" rel="stylesheet" type="text/css">
<link href="../../../../../assets/blog/css/cayman.css" rel="stylesheet" type="text/css">
<meta name="theme-color" content="#5670d4">
<meta name="generator" content="Nikola (getnikola.com)">
<link rel="alternate" type="application/rss+xml" title="RSS" hreflang="en" href="../../../../../rss.xml">
<link rel="canonical" href="francescomecca.eu/blog/2016/4/2/blog-migrated/">
<meta name="author" content="Francesco Mecca">
<link rel="prev" href="../buridan_donkey/" title="The Buridan's donkey in python" type="text/html">
<link rel="next" href="../../10/short-lesson-from-reddit/" title="Bright Father" type="text/html">
<meta property="og:site_name" content="Caught in the Net">
<meta property="og:title" content="How I migrated to a static blog">
<meta property="og:url" content="francescomecca.eu/blog/2016/4/2/blog-migrated/">
<meta property="og:description" content="Until one week ago my blog was hosted at my house, on a raspberrypi with debian + wordpress. I was not satisfied by my setup because given the minimal size of my blog and the really scarce content I p">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2016-04-02T00:00:00Z">
<meta property="article:tag" content="jekyll">
<meta property="article:tag" content="PesceWanda">
<meta property="article:tag" content="static blog">
</head>
<body>
<div id="container">
<section class="page-header"><h1 class="project-name">
Caught in the Net
</h1>
<h2 class="project-tagline">La rete ti cattura ma libera il pensiero</h2>
<a class="btn" href="../../../../../">Home</a>
<a class="btn" href="../../../../../pages/about/">About me</a>
<a class="btn" href="../../../../../pages/contattami/">Contact me</a>
<a class="btn" href="../../../../../archiveall.html">Archive</a>
<a class="btn" href="../../../../../rss.xml">RSS</a>
<a class="btn" href="http://francescomecca.eu/git/pesceWanda">Personal Git</a>
<a class="btn" href="https://github.com/FraMecca">Github</a>
<a class="btn" href="https://lezzo.org/git/public/Curriculum_vitae/raw/master/latex.dir/francesco_mecca_cv_eng.pdf">Curriculum</a>
</section><section class="main-content"><div class="post">
<header><h1 class="post-title">
<h1 class="p-name post-title" itemprop="headline name">How I migrated to a static blog</h1>
</h1>
</header><p class="dateline post-date">02 April 2016</p>
</div>
<div class="e-content entry-content" itemprop="articleBody text">
<p>Until one week ago my blog was hosted at my house, on a raspberrypi with debian + wordpress. I was not satisfied by my setup because given the minimal size of my blog and the really scarce content I post every now and then, a full LLMP stack was overblown.
I decided to change distribution (my server now runs <a href="http://www.voidlinux.eu/">Void</a>) and to migrate to a static blog without CMS nor PHP.</p>
<h2>Welcome to Jekyll and Hyde</h2>
<p>The process of migration was rather painless.
First of all I installed ruby on my desktop computer, then via ruby gems I installed jekyll:</p>
<p><code>gem install jekyll</code></p>
<p><code>gem install jekyll-gist</code></p>
<p><code>gem install jekyll-paginate</code></p>
<p>I used a <a href="https://wordpress.org/plugins/jekyll-exporter/">wordpress plugin</a> to copy all my old posts.
Then I cloned from <a href="https://github.com/poole/hyde">git</a> the Hyde theme which you can see a demo <a href="http://hyde.getpoole.com/">here</a> and corrected a pair of warning that jekyll printed on my terminal. Actually the <a href="http://jekyllrb.com/docs">jekyll docs</a> are quite complete and covered all the errors that I encountered.</p>
<p>Jekyll structure is quite simple to understand: in the folder _post/ there are your post in markdown format (remember to delete the examples in that folder);
in the root the are some files that should be modified: the about.md file, the 404 page and index.html that is the frontpage of the blog;
finally _config.yml contains the general configuration for the website and should be adjusted to your own likings.
When Jekyll builds a website it parses all the markdown files and stores them in _site folder. Jekyll uses the html files in _layouts and _includes to render the markdown files.A</p>
<p>I added a simple <a href="http://francescomecca.eu/archive/">archive page</a> following the little piece of code in <a href="http://joshualande.com/jekyll-github-pages-poole/">this page</a>
{% raw %}
---
layout: page
title: Archive
---</p>
<div class="code"><pre class="code literal-block"><span class="x">## Blog Posts</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">post</span> <span class="k">in</span> <span class="nv">site.posts</span> <span class="cp">%}</span>
<span class="x"> * </span><span class="cp">{{</span> <span class="nv">post.date</span> <span class="o">|</span> <span class="nf">date_to_string</span> <span class="cp">}}</span><span class="x"> &amp;raquo; [ </span><span class="cp">{{</span> <span class="nv">post.title</span> <span class="cp">}}</span><span class="x"> ](</span><span class="cp">{{</span> <span class="nv">post.url</span> <span class="cp">}}</span><span class="x">)</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span><span class="x">:wq</span>
</pre></div>
<p>{% endraw %}
I noticed that in _includes/head.html there is this line:</p>
<div class="code"><pre class="code literal-block"><span class="p">&lt;</span><span class="nx">link</span><span class="w"> </span><span class="nx">href</span><span class="p">=</span><span class="err">'</span><span class="nx">https</span><span class="p">:</span><span class="c1">//fonts.googleapis.com/css?family=Open+Sans:400,300,700,800,600' rel='stylesheet' type='text/css'</span>
</pre></div>
<p>so I proceed to remove it because is not needed for my blog.
Finally I put a link to the archive, my github page and the atom feed on the sidebar by simple adding a href on _includes/sidebar.html.</p>
<p>I did not proceed with further modifications but there are tons of possibilities with jekyll. I think that the main advantages are the fact that you don't have to manage html code when writing a new post and that everything can be done via cli.</p>
<p>Francesco Mecca</p>
</div>
<aside class="postpromonav"><nav><h4>Categories</h4>
<ul itemprop="keywords" class="tags">
<li><a class="tag p-category" href="../../../../../categories/jekyll/" rel="tag">jekyll</a></li>
<li><a class="tag p-category" href="../../../../../categories/pescewanda/" rel="tag">PesceWanda</a></li>
<li><a class="tag p-category" href="../../../../../categories/static-blog/" rel="tag">static blog</a></li>
</ul></nav></aside><p class="sourceline"><a href="index.md" class="sourcelink">Source</a></p>
<footer class="site-footer" id="footer"><span> CC BY-SA 4.0 International.<br></span>
<span class="site-footer-credits"><a href="https://getnikola.com">Nikola</a>, <a href="https://github.com/jasonlong/cayman-theme">Cayman theme</a>.</span>
</footer></section>
</div>
</body>
</html>