Code Monkey home page Code Monkey logo

Harp’s Blog Boilerplate

This is a boilerplate to use with the Harp Platform and/or the Harp Server (a static web server with built-in pre-processing build with NodeJS)

Index


How to use it?

On your own computer

  1. Install Harp Server on your computer
  2. Open your terminal and start a new project:
$ git clone [email protected]:harp-boilerplates/hb-blog.git my-blog
$ cd my-blog
$ harp server -p 9966

Go to http://localhost:9966 from your browser to see your website.

On the Harp Platform

  1. Login to the Harp Platform
  2. Create a new application
  3. Choose Blog Boilerplate as your starting point
  4. Start your application
  5. Open and edit the files in your Dropbox

Controlling your content

Harp brings you back to the basics of the web. Always keep in mind that your directory structure and file names are your URL paths.

Creating a new page is as simple as creating a new file and writing content in it.

public/posts

This is where your posts and their content live.

public/_layout.jade

The layout of your site, including header, footer and sidebar. External scripts or stylesheets are included in this file. Global elements belong here as well (i.e.: header, nav, sidebar, etc.)

public/index.jade

This is the default page when you visit your domain (i.e.: http://localhost:9966/). Here we build the loop that goes through your posts and shows them in the front page.

public/assets/css/app.less

This is the place where your blog CSS should live.

Adding new posts

1. Create a new file (.jade, .ejs, .html or .md) in the public/posts/ directory

$ touch public/posts/kittens.html

2. Enter your post content in the file you just created:

public/posts/kittens.html:

<h1><a href="/posts/kittens">I love kittens!</a></h1>
<p>This is my first post using Harp!</p>

3. Open public/posts/_data.json and add your new post data:

{
  ...                        <-- other blog posts
  "kittens": {               <-- post slug (file name without extension)
    "title": "Cute Kittens"  <-- post title
  }
  ...                        <-- other blog posts
}

Adding new pages

1. Create a new file inside the public directory:

$ touch public/about.html

2. Enter the page content in the newly created file

public/about.html:

<h1>About me</h1>
<p>I love fotoshapz and taking pictures of foods</p>

3. Your can now access your page in your browser. I.e.: http://localhost:9966/about

Migrating from a WordPress blog

If you’re planning to move your WordPress site to Harp, I’d recommend cloning it using wget or curl:

This one-line terminal command will create a static replica of yourwebsite.com in your computer, it’ll fix all the links to work locally and download all the necessary assets (images, javascript, css and other files):

$ wget --recursive --no-clobber --page-requisites --html-extension --convert-links yourwebsite.com

Enabling/Disabling Comments

This blog boilerplate makes it really easy to enable your visitors to leave comments on your blog posts.

Open the /harp.json file and look for the disqus section. It should look something like this:

...
"disqus": {
  "enabled": false,
  "shortname": ""
}
...

In the disqus configuration there are two configurable keys:

enabled: can be true or false. Make it true to display comments and false to disable them. Make sure the value is not wrapped in quotes like this "false", otherwise it will still show the comments.

shortname: this is your shortname assigned by Disqus. Signup for Disqus and get your own shortname, then enter it as a string (with wrapping double quotes) as the shortname value.

This is what it looks like when it’s enabled:

...
"disqus": {
  "enabled": true,
  "shortname": "jorgepedret"
}
...

Enabling/Disabling Sitemap.xml

Open the /harp.json file and look for the sitemap section:

...
"sitemap": {
  "enabled": true,
  "changefreq": "daily"
}
...

Change "changefreq" to fit your blog needs. The result will be live in /sitemap.xml

Support

Please create an issue on github’s bug tracker. Feedback and bug reports are greatly appreciated.

License

MIT

Col Wilson's Projects

dynamic-dns-updater icon dynamic-dns-updater

Script to check if your provider has changed you IP address and call a callback if it has

eve icon eve

A REST Web API framework that's as dangerous as you want it to be.

flask-lazyapi icon flask-lazyapi

A Simple, Restful MongoDB Server built on Flask and Flask-Classy

flasker icon flasker

Flask, Celery, SQLAlchemy integration

grunt-bakeoff icon grunt-bakeoff

preprocess your html5 templates to add minification, svg images, coffeescript, lesscss and versioning

node-csv icon node-csv

Full featured CSV parser with simple api and tested against large datasets.

py-web-search icon py-web-search

A Python module to fetch and parse results from different search engines.

simpleapi icon simpleapi

A simple API-framework to provide an easy to use, consistent and portable client/server-architecture (standalone and also for django, Flask, AppEngine and all WSGI-compatible implementations like gunicorn).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.