Custom Javascript In Jekyll Blogs
Not that this graph has anything meaningful, but it was easy to create using visjs.org. Follow along and I’ll show you have to create this on you Jekyll Blogs. You can also view a good tutorial by Emma Tosch.
Step to Add Javascript on Github Pages
Create a subdirectory
mkdir -p _includes/graphs
Create the following
_includes/graphs/dag_default.js
,
but don’t include any script
tags.
Edit _includes/head.html
You can view the full file _includes/head.html but below are my changes.
Modify _layout/post.html
Note this needs to go near the bottom of the _layout/post.html
Creating Pages
Here’s a sample header on my markdown page
---
layout: post
title: "Adding Javascript "
date: 2016-12-22 16:32:39 -0400
jsarr:
- graphs/dag_default.js
categories: Javascript
---
Reference
If you get stuck, checkout the source repository