diff options
Diffstat (limited to 'layouts/templates')
-rw-r--r-- | layouts/templates/main.html | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/layouts/templates/main.html b/layouts/templates/main.html new file mode 100644 index 0000000..917bdce --- /dev/null +++ b/layouts/templates/main.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<html lang="{{ .Site.LanguageCode }}"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title var="$page.title.suffix('|', $site.title)"></title> + <link rel="stylesheet" href="/css/style.css"/> + <link rel="stylesheet" href="/css/fonts.css"/> + </head> + + <body> + <nav> + <ul class="menu"> + <li><a href="/">home</a></li> + <li><a href="/">about</a></li> + <li><a href="/">rss</a></li> + </ul> + <hr/> + </nav> + + <div id="main"> + <super/> + </div> + + <footer> + {{ if or (.Params.author) (gt .Params.lastmod 0) }} + <div class="article-meta"> + {{ with .Params.author }}Author <span class="author">{{ . }}</span><br/>{{ end }} + {{ if (gt .Params.lastmod 0) }}Updated <span class="date">{{ .Lastmod.Format "January 02, 2006" }}</span><br/>{{ end }} + </div> + {{ end }} + + {{ if .Param "comments" }} + <h2>comments</h2> + <div style="visibility: hidden" id="comments">comments go here</div> + <div style="visibility: hidden" id="comment_form">comment form goes here</div> + <script> + let comments = document.getElementById("comments"); + let urlParam = new URLSearchParams(); + urlParam.append("url", document.location.href); + fetch(document.location.origin + "/api/comment?" + urlParam.toString()) + .then((response) => response.text()) + .then((data) => { + comments.innerHTML = data; + comments.style.visibility = "visible"; + }); + let form = document.getElementById("comment_form"); + fetch(document.location.origin + "/api/form?" + urlParam.toString()) + .then((response) => response.text()) + .then((data) => { + form.innerHTML = data; + form.style.visibility = "visible"; + }); + </script> + <noscript>Comments disabled without javascript!</noscript> + {{ end }} + </footer> + </body> +</html> |