Sidewalk theme for Grav

Standard

I developed Sidewalk. My first theme for Grav CMS. Grav is a flat-file CMS written in PHP developed by Rocket Themes. The theme is inspired by hexo-jade-barebone.

Installing the theme.

Clone the Sidewalk repository into your Grav CMS theme directory.

cd /user/themes/  
git clone https://github.com/DarrylDias/Sidewalk.git

Now change the `theme:` string to Sidewalk

pages:  
  theme: Sidewalk

Now you have Sidewalk theme running on your Grav CMS.

You can edit the Sidewalk.yaml to customise the theme

Thank you for reading, you can drop me a line at my contact page, or have a quick chat by hitting the blue button at the bottom right

Open links in new tab using jQuery

Open links in new tab using jQuery Image 2
Standard

The most common way to open links in a new tab is to middle click the link in the web browser or right-click. To open a link in a new tab by default you need to add target="_blank" to the hyper links, but this would get annoying over time if you have to add this to every link in your source. You can add this simple jQuery snippet to your source to open every external link in a new tab of the web browser. If you don’t already have jQuery need a local copy of it or use Google’s hosted library CDN for jQuery.

 <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

You need to load jQuery before this script loads or else this script won’t work.

$(document).ready(function(){
  $('a').each(function() {
    var a = new RegExp('/' + window.location.host + '/');
    if(!a.test(this.href)) {
      $(this).click(function(event) {
        event.preventDefault();
        event.stopPropagation();
        window.open(this.href, '_blank');
      });
    }
  });
});

Wintersmith on Raspberry Pi

Standard

Wintersmith is a open source flexible static website generator writen in Node.js that uses Jade for templating and Marked.

Jade is a simple and easy to use templating engine that supports complete HTML markup and uses indent to nest a specific tag in or out of another tag. Marked is a Markdown parser that supports GitHub Flavoured Markdown. Wintersmith stores it’s preferences and settings in a <code class="highlighter-rouge">config.json file. Wintersmith is faster than most of the popular static website generator, Wintersmith can gain more functionality when plugins are added by default, Wintersmith ships with <code class="highlighter-rouge">paginator.coffee plugin that lets you paginate your posts. Wintersmith is also very lightweight which makes it a winner for the Raspberry Pi in the static website world.

We can begin by installing Wintersmith by following a few simple steps.

Installing Node.js on Debian based Linux distribution for Raspberry Pi (Raspbian, PiBang).

Downloading

<code class="language- bash">wget http://node-arm.herokuapp.com/node_latest_armhf.deb  

Installing

<code class="language- bash">sudo dpkg -i node_latest_armhf.deb  

Installing Node.js on Arch Linux ARM for Raspberry Pi.

<code class="language- bash">sudo pacman -Sy nodejs  

Installing on Fedora based Linux distribution for Raspberry Pi (Fedora ARM, Pidora).

<code class="language- bash">sudo yum install node npm  

Once you are done installing Node.js on your Raspberry Pi, we can now go ahead and successfuly install Wintersmith.

<code class="language- bash">sudo npm install -g wintersmith  

We now have Wintersmith installed on our Raspberry Pi.

You can now create you first Wintersmith based website.

<code class="language- bash">wintersmith new Blog  

Now you can enter the directory.

<code class="language- bash">cd Blog/  

We can load the preview web server that comes built-in in Wintersmith.

<code class="language- bash">wintersmith preview  

We can alslo build the output files.

<code class="language- bash">wintersmith build  

To customise your website edit the <code class="highlighter-rouge">config.json.