aboutsummaryrefslogtreecommitdiff
path: root/src/html
diff options
context:
space:
mode:
authorMark Powers <markppowers0@gmail.com>2019-03-10 19:46:26 -0400
committerMark Powers <markppowers0@gmail.com>2019-03-10 19:46:26 -0400
commit23c5e6810888c30f10167405f0516f62b32d8f5b (patch)
tree698a2c1db68fa77bae48e20f0240aca3b11cd826 /src/html
parenta119a3c73f02408b0e2ceedf0ac71e4e684b4cad (diff)
Added tag viewer
Diffstat (limited to 'src/html')
-rw-r--r--src/html/blog.html1
-rw-r--r--src/html/feed.html2
-rw-r--r--src/html/tags.html40
3 files changed, 41 insertions, 2 deletions
diff --git a/src/html/blog.html b/src/html/blog.html
index 01cd2f6..a0a9361 100644
--- a/src/html/blog.html
+++ b/src/html/blog.html
@@ -11,7 +11,6 @@
<!-- <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> -->
<script>
window.onload = loadFeed(function () {
- console.log("callback!");
var feed = new Vue({
el: '.feed',
data: {
diff --git a/src/html/feed.html b/src/html/feed.html
index 358ef61..5b8cccd 100644
--- a/src/html/feed.html
+++ b/src/html/feed.html
@@ -9,7 +9,7 @@
<p class="date">
{{ post.createdAt.substring(0,10) }}
<span v-for="tag in post.tags">
- <a class="tag" href="#">{{tag}}</a>
+ <a class="tag" v-bind:href="'/tags#'+tag">{{tag}}</a>
</span>
</p>
</div>
diff --git a/src/html/tags.html b/src/html/tags.html
new file mode 100644
index 0000000..9c6174d
--- /dev/null
+++ b/src/html/tags.html
@@ -0,0 +1,40 @@
+<!doctype html>
+<html lang="en">
+
+<head>
+ <title>Mark's Kitchen - Blog</title>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <link rel="stylesheet" type="text/css" href="/css/styles.css">
+ <script src="/js/feed.js"></script>
+ <script src="https://cdn.jsdelivr.net/npm/vue"></script>
+ <!-- <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> -->
+ <script>
+ window.onload = window.onhashchange = function () {
+ loadFeed(function () {
+ var feed = new Vue({
+ el: '#view',
+ data: {
+ posts: [],
+ tag: window.location.hash
+ },
+ created() {
+ console.log(this.tag);
+ var tag = window.location.hash.substring(1);
+ fetch(new Request(`/tags/${tag}`)).then(response => response.json())
+ .then(response => this.posts = response);
+ }
+ });
+ })
+ }
+ </script>
+</head>
+
+<body>
+ <div id="view">
+ <h1>Selecting: {{tag}}</h1>
+ <div id="feed"></div>
+ </div>
+</body>
+
+</html> \ No newline at end of file