summaryrefslogtreecommitdiff
path: root/src/web/templates
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@protonmail.ch>2022-05-28 14:45:09 +0530
committerVidhu Kant Sharma <vidhukant@protonmail.ch>2022-05-28 14:45:09 +0530
commita4a83e4b549e858d4f8c821591bfb74706d846e8 (patch)
treeff6a149e5be2da768f6fec5c9c5145e44d689f6b /src/web/templates
parent8580139fe065036d4946a5fbd27a1334a0d92ab7 (diff)
Moved the blog to new repositoryHEADmain
Diffstat (limited to 'src/web/templates')
-rw-r--r--src/web/templates/partials/navbar.html9
-rw-r--r--src/web/templates/partials/tags_menu.html18
-rw-r--r--src/web/templates/views/home.html54
-rw-r--r--src/web/templates/views/post.html44
-rw-r--r--src/web/templates/views/posts.html67
5 files changed, 192 insertions, 0 deletions
diff --git a/src/web/templates/partials/navbar.html b/src/web/templates/partials/navbar.html
new file mode 100644
index 0000000..223c3f3
--- /dev/null
+++ b/src/web/templates/partials/navbar.html
@@ -0,0 +1,9 @@
+{{ define "partials/navbar.html" }}
+<nav id="navbar">
+ <ul>
+ <a href="https://www.youtube.com/watch?v=DaWbq6KeJq4&list=RDxA_4ZFe1TME&index=16">
+ <li>This UGLY Navbar Is Just A Placeholder</li>
+ </a>
+ </ul>
+</nav>
+{{ end }}
diff --git a/src/web/templates/partials/tags_menu.html b/src/web/templates/partials/tags_menu.html
new file mode 100644
index 0000000..8f1c3ee
--- /dev/null
+++ b/src/web/templates/partials/tags_menu.html
@@ -0,0 +1,18 @@
+{{ define "partials/tags_menu.html" }}
+<div class="tags-menu">
+ <form class="tags-switcher" action="/posts/filter-by-tags" method="POST">
+ <div class="options">
+ {{ range .Tags }}
+ <label class="tag-label">
+ <input type="checkbox" name="tags" value="{{ .TagID }}" id="{{ .TagID }}" class="{{ if .IsSelected }}active{{ end }}">
+ <span class="tag {{ if .IsSelected }}active{{ end }}">{{ .TagName }}</span>
+ </label>
+ {{ end }}
+ </div>
+ <div class="menu">
+ <input type="reset" value="Clear"/>
+ <input type="submit" value="Filter"/>
+ </div>
+ </form>
+</div>
+{{ end }}
diff --git a/src/web/templates/views/home.html b/src/web/templates/views/home.html
new file mode 100644
index 0000000..8ab791b
--- /dev/null
+++ b/src/web/templates/views/home.html
@@ -0,0 +1,54 @@
+{{ define "views/home.html" }}
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <meta name="description" content="Vidhu Kant's Blog" />
+ <link type="text/css" rel="stylesheet" href="/css/styles.css">
+ <link type="text/css" rel="stylesheet" href="/css/home.css">
+ <title>Vidhu Kant's Blog</title>
+</head>
+<body>
+ <div class="header" id="header">
+ <h1 id="welcome-title">Welcome to Vidhu Kant's Blog!</h1>
+ <p id="welcome-subtitle">Here, I talk about the various topics that interest me.</p>
+ <p>-- important links, maybe navbar, info (probably shit like last update date or number of blogs this week/month/whatever) --</p>
+ </div>
+
+ <div class="links-container" id="links">
+ <span class="links">
+ <a href="/posts">View All Posts</a>
+ <a href="/tags">Filter By Tags</a>
+ <a href="/about">About This Blog</a>
+ </span>
+ </div>
+
+ <div class="recents" id="recents">
+ <h2 class="recents-label" id="recent-posts-label">
+ My Recent Articles:
+ </h2>
+ <div class="posts" id="recent-posts">
+ {{ range .RecentPosts }}
+ <div class="post">
+ <span class="post-createdat">{{ .CreatedAt }}: </span>
+ <a href="/posts/{{ .ID }}">{{ .Title }}</a>
+ </div>
+ {{ end }}
+ </div>
+ <!-- obviously there are no "recent" tags,
+ just keeping up with naming scheme -->
+ <h2 class="recents-label" id="recent-tags-label">
+ Browse Articles by Tags:
+ </h2>
+ <div class="tags" id="recent-tags">
+ {{ range .Tags}}
+ <a href="/posts/?tags={{ .ID }}">{{ .Name }}</a>
+ {{ end }}
+ </div>
+ </div>
+
+ {{ .Message }}
+</body>
+</html>
+{{ end }}
diff --git a/src/web/templates/views/post.html b/src/web/templates/views/post.html
new file mode 100644
index 0000000..ecd1a14
--- /dev/null
+++ b/src/web/templates/views/post.html
@@ -0,0 +1,44 @@
+{{ define "views/post.html" }}
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <meta name="description" content="Vidhu Kant's Blog Post #{{ .ID }}: {{ .Title }}" />
+ <link type="text/css" rel="stylesheet" href="/css/styles.css">
+ <link type="text/css" rel="stylesheet" href="/css/post.css">
+ <title>
+ {{ .Title }} | Vidhu Kant's Blog Post
+ </title>
+</head>
+<body>
+ {{ template "partials/navbar.html" .}}
+ <article>
+ <div class="post-header" id="header">
+ <h1 class="post-title" id="title">
+ {{ .Title }}
+ </h1>
+ <div class="post-info" id="info">
+ <span class="post-created-at" id="created-at">
+ {{ .CreatedAt }}
+ {{ if .UpdatedAt }} <span class="post-updated-at" id="created-at">(Last Updated {{ .UpdatedAt }})</span> {{- end }}
+ </span>
+ </div>
+ </div>
+ <hr class="header-seperator">
+
+ <div class="post-content" id="content">
+ {{ .Content }}
+ </div>
+
+ <div class="post-footer" id="footer">
+ {{ .post_footer }}
+ </div>
+ </article>
+ <noscript>
+ <p>Ahh I see you're a man of culture!</p>
+ <p>(Because you have JavaScript disabled)</p>
+ </noscript>
+</body>
+</html>
+{{ end }}
diff --git a/src/web/templates/views/posts.html b/src/web/templates/views/posts.html
new file mode 100644
index 0000000..e992564
--- /dev/null
+++ b/src/web/templates/views/posts.html
@@ -0,0 +1,67 @@
+{{ define "views/posts.html" }}
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <meta name="description" content="BLOG DESCRIPTION GHERE" />
+ <link type="text/css" rel="stylesheet" href="/css/styles.css">
+ <link type="text/css" rel="stylesheet" href="/css/posts.css">
+ <title>
+ Index Page
+ </title>
+</head>
+<body>
+ {{ template "partials/navbar.html" .}}
+ {{ template "partials/tags_menu.html" .}}
+ <article>
+ <div class="options" id="options-header">
+ <span class="limit-options">
+ Posts to show per page:
+ {{ range .LimitOptions }}
+ <a href="?page={{ $.PageNumber }}&limit={{ . }}&first={{ $.FirstPost }}&sort_by={{ if $.SortByOldest }}oldest{{ else }}newest{{ end }}"
+ class="{{ if eq . $.Limit }}active{{- end }}">
+ {{ . }}
+ </a>
+ {{ end }}
+ </span>
+ <span id="page-sort">
+ Currently sorting by {{ if .SortByOldest }}oldest{{ else }}newest{{ end }} first.
+ <!--a href="?page={{ .PageNumber }}&limit={{ .Limit }}&first={{ .FirstPost }}&sort_by={{ if .SortByOldest }}newest{{ else }}oldest{{ end }}"-->
+ <a href="?limit={{ .Limit }}&sort_by={{ if .SortByOldest }}newest{{ else }}oldest{{ end }}">
+ Sort by {{ if .SortByOldest }}newest{{ else }}oldest{{ end }} first?
+ </a>
+ </span>
+ </div>
+ <div class="posts">
+ {{ range .Posts }}
+ <div class="post">
+ <span class="post-title-tags">
+ <a class="post-title" href="{{ .ID }}">{{ .Title }}</a>
+ <span class="post-tags">
+ {{ range .Tags }}
+ <a class="post-tag" href="/posts?tags={{ .ID }}">{{ .Name }}</a>
+ {{ end }}
+ </span>
+ </span>
+ <div class="post-info">
+ <span class="post-createdat">{{ .CreatedAt }}</span>
+ </div>
+ </div>
+ {{ end }}
+ </div>
+ <div class="options" id="options-footer">
+ <span class="paging-options">
+ {{ if .ShowPrev }}
+ <a href="?page={{ .PrevPage }}&limit={{ .Limit }}&first={{ .PrevFirst }}&sort_by={{ if .SortByOldest }}oldest{{ else }}newest{{ end }}">Previous Page</a>
+ {{- end }}
+
+ {{ if .ShowNext }}
+ <a href="?page={{ .NextPage }}&limit={{ .Limit }}&first={{ .NextFirst }}&sort_by={{ if .SortByOldest }}oldest{{ else }}newest{{ end }}">Next Page</a>
+ {{- end }}
+ </span>
+ </div>
+ </article>
+</body>
+</html>
+{{ end }}