Skip to content

Commit

Permalink
📝🚜 Add Google Analytics (#241)
Browse files Browse the repository at this point in the history
* Rearrange function order
* Add Google Analytics and rearrange pug templates
  • Loading branch information
bbody authored Dec 4, 2018
1 parent c782955 commit a96420b
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 61 deletions.
20 changes: 10 additions & 10 deletions dist/cmd-resume.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* v5.0.0 of CMD Resume by Brendon Body(https://github.com/bbody/CMD-Resume.git) */
/* v5.0.1 of CMD Resume by Brendon Body(https://github.com/bbody/CMD-Resume.git) */
;(function($){
"use strict";

Expand Down Expand Up @@ -88,6 +88,15 @@
}
};

// Get key array
var getKeyArray = function(key) {
if (Array.isArray(key)) {
return key;
} else {
return [key];
}
};

// Get value
var getDataFromArrayKey = function(data, keys) {
keys = getKeyArray(keys);
Expand All @@ -104,15 +113,6 @@
return data;
};

// Get key array
var getKeyArray = function(key) {
if (Array.isArray(key)) {
return key;
} else {
return [key];
}
};

// Check if an object has key and has length
var isDefinedNotEmpty = function(object, key, isObject) {
if (!key || !object) {
Expand Down
4 changes: 2 additions & 2 deletions dist/cmd-resume.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ gulp.task('compile:html', function() {
favicon_directory: './favicons'
};
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
return gulp.src('index.pug')
return gulp.src('templates/index.pug')
.pipe(pug({
locals: locals
}))
Expand All @@ -278,7 +278,7 @@ gulp.task('compile:html:example', function() {
favicon_directory: '.'
};
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
return gulp.src('index.pug')
return gulp.src('templates/index.pug')
.pipe(pug({
locals: locals
}))
Expand All @@ -299,7 +299,7 @@ gulp.task('compile:html:own-example', function() {
favicon_directory: '..'
};
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
return gulp.src('index.pug')
return gulp.src('templates/index.pug')
.pipe(pug({
pretty: true,
locals: locals
Expand All @@ -321,7 +321,7 @@ gulp.task('compile:html:test', function() {
favicon_directory: '.'
};
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
return gulp.src('index.pug')
return gulp.src('templates/index.pug')
.pipe(pug({
locals: locals
}))
Expand Down
35 changes: 0 additions & 35 deletions index.pug

This file was deleted.

18 changes: 9 additions & 9 deletions js/helpers/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ var isValidColor = function(color) {
}
};

// Get key array
var getKeyArray = function(key) {
if (Array.isArray(key)) {
return key;
} else {
return [key];
}
};

// Get value
var getDataFromArrayKey = function(data, keys) {
keys = getKeyArray(keys);
Expand All @@ -37,15 +46,6 @@ var getDataFromArrayKey = function(data, keys) {
return data;
};

// Get key array
var getKeyArray = function(key) {
if (Array.isArray(key)) {
return key;
} else {
return [key];
}
};

// Check if an object has key and has length
var isDefinedNotEmpty = function(object, key, isObject) {
if (!key || !object) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"jquery-plugin",
"ecosystem:jquery"
],
"version": "5.0.0",
"version": "5.0.1",
"author": {
"name": "Brendon Body",
"url": "https://github.com/bbody"
Expand Down
24 changes: 24 additions & 0 deletions templates/index.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
doctype html
html(lang='en')
head
title=sitename
meta(charset='utf-8')
if production
meta(name='author', content='Brendon Body - https://github.com/bbody/CMD-Resume')
meta(name='Description', content='CMD Resume using JQuery Terminal')

include partials/favicons.pug

script(src=jquery_script_location, type="text/javascript")
script(src=cmd_resume_script_location, type="text/javascript")
script(src=keyboard_polyfill, type="text/javascript")
script(src=jquery_terminal_script_location, type="text/javascript")
if init_script_location
script(src=init_script_location, type="text/javascript")
link(href=jquery_terminal_stylesheet_location, rel='stylesheet')

if production
include partials/analytics.pug
body
if production
include partials/github_banner.pug
5 changes: 5 additions & 0 deletions templates/partials/analytics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-130419778-1');
4 changes: 4 additions & 0 deletions templates/partials/analytics.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Global site tag (gtag.js) - Google Analytics
script
include analytics.js
script(async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-130419778-1")
14 changes: 14 additions & 0 deletions templates/partials/favicons.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
link(rel="apple-touch-icon", sizes="180x180", href=favicon_directory+"/apple-touch-icon.png")
link(rel="icon", type="image/png", sizes="32x32", href=favicon_directory+"/favicon-32x32.png")
link(rel="icon", type="image/png", sizes="16x16", href=favicon_directory+"/favicon-16x16.png")
link(rel="manifest", href=favicon_directory+"/site.webmanifest")
link(rel="mask-icon", href=favicon_directory+"/safari-pinned-tab.svg", color="#000000")
meta(name="msapplication-TileColor", content="#ffffff")
meta(name="theme-color", content="#ffffff")

meta(property="og:image:width", content="550")
meta(property="og:image:height", content="288")
meta(property="og:title", content=sitename)
meta(property="og:description", content="Web-based Command Line Resume")
meta(property="og:url", content="https://cmd-resume.bbody.io/")
meta(property="og:image", content="https://s3-ap-southeast-2.amazonaws.com/bbody-images/github/cmd-resume/og-image.jpg")
2 changes: 2 additions & 0 deletions templates/partials/github_banner.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a(href='https://github.com/bbody/CMD-Resume')
img(style='position: absolute; top: 0; right: 0; border: 0; z-index: 100;' src='https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67' alt='Fork me on GitHub' data-canonical-src='https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png')

0 comments on commit a96420b

Please sign in to comment.