-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpage_template.html
More file actions
91 lines (56 loc) · 2.25 KB
/
page_template.html
File metadata and controls
91 lines (56 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<head>
<title>{{ title }}</title>
<link rel="stylesheet" type="text/css" href= "/css/main.css" >
<!-- The CSS file is at "css/main.css", but we need to adjust that file path depending on how nested the in the directory structure the page is. -->
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-205493387-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-205493387-1');
</script>
</head>
<body>
<!--Navigation bar-->
<div id="nav-placeholder">
</div>
<!--This /\ is where the Nav bar goes on the page.
this \/ is the code that goes and gets the nav bar content from nav.html-->
<script>
$(function(){
$("#nav-placeholder").load("nav.html");
});
</script>
<!--end of Navigation bar-->
<div class="page title">
<h1> </h1>
</div>
<div class="main text">
{{ content }}
</div>
<div id="last updated">
<script>
// this part gets the file name from the URL.
var urlArray = window.location.href.split("/");
var nameOfThisPage = urlArray[urlArray.length-1];
// this part uses the github API to get the last commit data for that file, and then writes a line the HTML body.
// future Eli, this is a function. It is in Arrow syntax. You should learn this.
const getCommits = async pageName => {
var result = await fetch('https://api.github.com/repos/etyre/elityre.com/commits?path='+ encodeURIComponent(pageName));
var data = await result.json();
var timestamp = new Date(data[0].commit.author.date)
// the Date function takes a date string, and returns a date object.
//var month = timestamp.getMonth()
var formattedDate = timestamp.toDateString()
console.log(formattedDate)
document.getElementById('last updated').innerHTML = "<p><br><br><i>This page was last updated on "+ formattedDate + ".</i></p>";
}
// const data = await getCommits('test');
// Make some notes about Await and what it does.
// Note that you can only use await inside of an async function.
getCommits(nameOfThisPage);
</script>
</div>