<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Design on Luiyología</title><link>https://luiyo.net/en/tags/design/</link><description>Recent content in Design on Luiyología</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Fri, 19 May 2017 00:00:00 +0000</lastBuildDate><atom:link href="https://luiyo.net/en/tags/design/index.xml" rel="self" type="application/rss+xml"/><item><title>Baking my Blog with JBake and GitHub</title><link>https://luiyo.net/en/blog/2017/05/baking-my-blog-with-jbake-and-github/</link><pubDate>Fri, 19 May 2017 00:00:00 +0000</pubDate><guid>https://luiyo.net/en/blog/2017/05/baking-my-blog-with-jbake-and-github/</guid><description>&lt;img src="https://luiyo.net/48611202357_c781558dfa_o_4087344123064251366.png" alt="Featured image of post Baking my Blog with JBake and GitHub" /&gt;&lt;p&gt;Almost since &lt;a class="link" href="https://luiyo.net/blog/2003/10/arranca-luiyologia/" &gt;I created my personal blog&lt;/a&gt; in 2003 I thought about moving it from blogger to my own domain, private hosting and so on. My laziness prevented me from doing so. Not because the migration itself, but for the maintenance it entailed.&lt;/p&gt;
&lt;p&gt;Anyhow, I was determined to migrate my blog outside of any blogging platform. I wanted to have complete control over my content, but without wasting lots of time in maintenance. All I needed was a way to do it seamlessly, quickly, and as automated as possible.&lt;/p&gt;
&lt;p&gt;The static site/blog generators appeared a long time ago but now they are multiplying and flourishing. I watched them and the surrounding tools for a long time&amp;hellip; and recently my atheist prayers were heard!&lt;/p&gt;
&lt;p&gt;I will describe briefly what I did &lt;strong&gt;to move my blog from blogger to Github Pages in a few hours&lt;/strong&gt;. The most time consuming task was to decide among a large number of excellent static site generators.&lt;/p&gt;
&lt;h2 id="step-1---choose-your-weapon"&gt;Step 1 - Choose your weapon
&lt;/h2&gt;&lt;p&gt;The reference here is &lt;a class="link" href="https://www.staticgen.com/" target="_blank" rel="noopener"
 &gt;StaticGen&lt;/a&gt;, a ranking with all the open source static site generators. The site itself is open source, and static generated (of course) using &lt;a class="link" href="http://middlemanapp.com/" target="_blank" rel="noopener"
 &gt;Middleman&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In &lt;em&gt;StaticGen&lt;/em&gt; you will need some time, filtering by programming language, sorting the options by stars, forks, &amp;hellip; Eventually you&amp;rsquo;ll chose one that covers your needs mainly in terms of language, templating technology or license.&lt;/p&gt;
&lt;p&gt;I was tempted to use &lt;a class="link" href="http://gohugo.io/" target="_blank" rel="noopener"
 &gt;Hugo&lt;/a&gt; but I selected &lt;a class="link" href="http://jbake.org/" target="_blank" rel="noopener"
 &gt;&lt;strong&gt;JBake&lt;/strong&gt;&lt;/a&gt; (created in 2013 by &lt;a class="link" href="http://jonathanbullock.com/" target="_blank" rel="noopener"
 &gt;Jonathan Bullock&lt;/a&gt;) instead of other much more popular options. The main reasons for me were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It&amp;rsquo;s &lt;strong&gt;Open Source&lt;/strong&gt; (&lt;a class="link" href="https://opensource.org/licenses/MIT" target="_blank" rel="noopener"
 &gt;MIT License&lt;/a&gt;). This is always the first element in my checklist&lt;/li&gt;
&lt;li&gt;It&amp;rsquo;s &lt;strong&gt;cross platform&lt;/strong&gt;, one of the main benefits to choose a product running in the JVM, right?&lt;/li&gt;
&lt;li&gt;Supports a good amount of &lt;strong&gt;content formats&lt;/strong&gt;: plain HTML, &lt;a class="link" href="http://daringfireball.net/projects/markdown/" target="_blank" rel="noopener"
 &gt;Markdown&lt;/a&gt;, &lt;a class="link" href="http://asciidoctor.org/" target="_blank" rel="noopener"
 &gt;AsciiDoc&lt;/a&gt;, &amp;hellip; this is great now that I write even my personal notes in markdown format&lt;/li&gt;
&lt;li&gt;Interesting &lt;strong&gt;template support&lt;/strong&gt;: &lt;a class="link" href="http://freemarker.org/" target="_blank" rel="noopener"
 &gt;Freemarker&lt;/a&gt;, &lt;a class="link" href="http://www.thymeleaf.org/" target="_blank" rel="noopener"
 &gt;Thymeleaf&lt;/a&gt;, &lt;a class="link" href="https://github.com/neuland/jade4j" target="_blank" rel="noopener"
 &gt;Jade&lt;/a&gt; or &lt;a class="link" href="http://www.groovy-lang.org/" target="_blank" rel="noopener"
 &gt;Groovy template framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Blog-ready&lt;/strong&gt; out of the box: RSS feed, tag support, archive, index pagination, &amp;hellip;&lt;/li&gt;
&lt;li&gt;Easy to integrate with &lt;strong&gt;CSS frameworks&lt;/strong&gt; as &lt;a class="link" href="http://getbootstrap.com/" target="_blank" rel="noopener"
 &gt;Bootstrap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Custom metadata&lt;/strong&gt; in the contents, even exposed to the templates. This is winner by itself&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;a class="link" href="http://jbake.org/docs/" target="_blank" rel="noopener"
 &gt;documentation of JBake&lt;/a&gt; could be improved, but it&amp;rsquo;s good enough.&lt;/p&gt;
&lt;p&gt;To install JBake, you can execute &lt;a class="link" href="http://jbake.org/download.html" target="_blank" rel="noopener"
 &gt;the last binary distribution&lt;/a&gt; but I recommend that you simply use &lt;a class="link" href="http://sdkman.io/" target="_blank" rel="noopener"
 &gt;&lt;strong&gt;SDKMAN&lt;/strong&gt;&lt;/a&gt;. If you don&amp;rsquo;t know what SDKMAN is, you are missing something special. After you have SDKMAN installed, enter the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;gt;&amp;gt; sdk install jbake
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Thanks Jonathan !!&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="step-2---choose-your-themestyle"&gt;Step 2 - Choose your theme/style
&lt;/h2&gt;&lt;p&gt;Some static generators support themes better than others, that&amp;rsquo;s for sure. This was important to me, and I checked that in &lt;em&gt;JBake&lt;/em&gt; the code responsible of the presentation is isolated enough from the content, so it&amp;rsquo;s more or less simple to change entirely the theme or style of your site.&lt;/p&gt;
&lt;p&gt;In fact, I didn&amp;rsquo;t start the personalization of my blog from the default theme and style. I cloned the &lt;a class="link" href="https://github.com/manikmagar/jbake-future-imperfect-template" target="_blank" rel="noopener"
 &gt;&lt;strong&gt;JBake Future Imperfect Template&lt;/strong&gt;&lt;/a&gt; by &lt;a class="link" href="https://twitter.com/manikmagar" target="_blank" rel="noopener"
 &gt;Manik Magar&lt;/a&gt; and for the moment I&amp;rsquo;ve only needed minor touches to make it better suited for me.&lt;/p&gt;
&lt;p&gt;As simple as this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;gt;&amp;gt; mkdir awesome-jbake
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;gt;&amp;gt; git clone https://github.com/manikmagar/jbake-future-imperfect-template.git awesome-jbake
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;gt;&amp;gt; cd awesome-jbake &lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ls -ltr
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Most of the changes were related to custom css styles that I was already using in Blogger, the &lt;em&gt;JBake Future Imperfect Template&lt;/em&gt; is fantastic.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Thanks Manik !!&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="step-3---migrate-your-content-from-your-old-blogsite-if-needed"&gt;Step 3 - Migrate your content from your old blog/site (if needed)
&lt;/h2&gt;&lt;p&gt;You&amp;rsquo;ll only need this if you are migrating something, skip this point if you are creating something from scratch.&lt;/p&gt;
&lt;p&gt;For this magic trick, my first intent was to implement it myself, only to code for a while. Finally I discovered a repo in github with a promising name: &lt;a class="link" href="https://github.com/cloudtu/blogger-to-jbake" target="_blank" rel="noopener"
 &gt;&lt;strong&gt;blogger-to-jbake&lt;/strong&gt;&lt;/a&gt;. I checked the code and the author (&lt;a class="link" href="http://cloudtu.github.io/" target="_blank" rel="noopener"
 &gt;Cloud Tu&lt;/a&gt;) had developed more or less what I meant to do.&lt;/p&gt;
&lt;p&gt;With a little help from an &lt;em&gt;difficult-even-for-google-translate&lt;/em&gt; &lt;code&gt;README&lt;/code&gt; file in Chinese, I could run the program and export all my blog only with minor problems regarding the download of certain images that were not hosted in blogger.&lt;/p&gt;
&lt;p&gt;The steps are very simple:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Modify the &lt;code&gt;src/main/resources/application.properties&lt;/code&gt; to set the Blogger atom file path, the output path and your current URL in Blogger&lt;/li&gt;
&lt;li&gt;Execute &lt;code&gt;gradlew run&lt;/code&gt; in the console&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Profit!&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I made some improvements (from my humble point of view) in the code, and I&amp;rsquo;ll send the corresponding pull request. They could be valuable for anyone else.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Thanks Cloud Tu !!&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="step-4---deploy-your-blog"&gt;Step 4 - Deploy your blog
&lt;/h2&gt;&lt;p&gt;Well, thanks to Github and specifically to &lt;a class="link" href="https://pages.github.com/" target="_blank" rel="noopener"
 &gt;Github Pages&lt;/a&gt;, the only thing that I needed was to change the configuration of JBake so the output directory for the &lt;em&gt;baked&lt;/em&gt; content is called &lt;code&gt;docs&lt;/code&gt; instead of the name by default (&lt;code&gt;output&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;After &lt;a class="link" href="https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/" target="_blank" rel="noopener"
 &gt;enabling it for the first time&lt;/a&gt;, Github automatically deploys in Github Pages whatever you put in the &lt;code&gt;docs&lt;/code&gt; directory of your repo.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m suffering the misbehavior of Github Pages with relative paths, but for the moment I&amp;rsquo;m solving it with a sed command before pushing the baked content.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Thanks Github Pages !!&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;I&amp;rsquo;m happier than ever with my blog, and I&amp;rsquo;ll try to write more often now that I can make it with my editor in Markdown or AsciiDoc.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also possible that I&amp;rsquo;ll write a more technical post about how JBake works, but in the meantime ask me in the comments anything that you want to know.&lt;/p&gt;</description></item></channel></rss>