aboutsummaryrefslogtreecommitdiff
path: root/src/html/tags.html
blob: 7f2cb16908571c38bde0488f2bdd6afcf29a2d96 (plain)
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
<!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>Viewing: {{tag}}</h1>
        <div id="feed"></div>
    </div>
</body>

</html>