diff options
Diffstat (limited to 'src/html')
-rw-r--r-- | src/html/blog.html | 1 | ||||
-rw-r--r-- | src/html/feed.html | 2 | ||||
-rw-r--r-- | src/html/tags.html | 40 |
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 |