Coder Social home page Coder Social logo

njb-said / blog Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 35 KB

My blog, nothing special just boring and ramblings

License: GNU General Public License v3.0

JavaScript 29.77% CSS 28.18% HTML 42.05%
blog nodejs node express mustache mustache-templates minimalist minimalistic markdown markdown-blog

blog's Introduction

blog Build Status Known Vulnerabilities

This repository contains the server that powers my blog, as well as all the posts. I can't promise I'll blog often or be remotely interesting, but if you find it somewhat interesting that's fine with me!

Builds are run on Travis CI for eslint compatibility and snyk is used for package security checks.

Posts

So all the posts are stored in the posts directory and are markdown files.
These are parsed at runtime with the marked library and have a browser cache time of 1 day by default. This can be overridden using the environment variable CACHE_HOURS.
The homepage shows a list of blog posts, sorted by their date.
Meta data about posts are in the posts/meta directory and are JSON files, these can have the following attributes:

  • title The title of the post
  • date The date of the post (in ISO format, you can find the date + time using new Date().toISOString() in a javascript console)
  • author The name of the person who wrote this post (optional)

You can generate a meta file using the /new_post page. This also has a markdown editor (SimpleMDE), you can also generate a slug for your post there too.

Backend

The actual server is written in node.js running a simple express app, which in my setup is fronted by Varnish for caching and then CloudFlare for global distribution.

The express server will load everything in the posts folder at startup and the associated meta files in posts/meta.

To change the blog title open web.js and change line 41 to the name of your blog, similarly change line 44 to your Google Analytics code to enable this (see below)

Analytics

For analytics I decided to just use Google Analytics, I didn't think it was worth introducing any other complexity or dependencies for now.

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.