aboutsummaryrefslogtreecommitdiff
path: root/src/html/blog.html
blob: c034711a3a71941f4848787ae89c004e7b4da7b7 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!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="https://cdn.jsdelivr.net/npm/vue"></script>
    <!-- <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> -->
    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    <script>
        window.onload = function () {
            var feed = new Vue({
                el: '.feed',
                data: {
                    posts: []
                },
                created() {
                    fetch(new Request('/posts/blog')).then(response => response.json())
                        .then(response => { response.forEach(post => {
                                post.description = marked(post.description)
                                this.posts.push(post);
                            });
                        });
                }
            });
        }
    </script>
</head>

<body>
    <div>
        <h1>
            <a class="navigation" href="/" title="marks.kitchen">&lt;</a>
            Blog
        </h1>
        <div id="feed" class="feed">
            <div class="card" v-for="post in posts">
                <p class="card-text" v-html="post.description"></p>
                <div class="card-img">
                    <span v-for="image in post.images">
                        <a v-bind:href="image"><img v-bind:src="image"></a>
                    </span>
                </div>
                <p class="date">
                    <a v-bind:href="'/blog/'+post.id">{{ post.createdAt.substring(0,10) }}</a>
                    <span v-for="tag in post.tags">
                        <a class="tag" v-bind:href="'/tags#'+tag">{{tag}}</a>
                    </span>
                </p>
            </div>
        </div>
    </div>
</body>

</html>