ejs stuff

This commit is contained in:
2025-07-22 00:17:00 +01:00
parent 7eeafddae4
commit cc131798a3
23 changed files with 311 additions and 89 deletions

4
views/headers/tag.ejs Normal file
View File

@@ -0,0 +1,4 @@
<h1>
Post's tagged "<%- tag %>":
</h1>
<%- config.seperator %>

View File

@@ -0,0 +1,13 @@
<h1>
<%- config.site_name %>
</h1>
<h2>
<%- config.site_description %>
</h2>
<a href="<%= config.rss_url %>">RSS Feed</a><br/>
<a href="<%= config.signup_url %>">Sign Up</a><br/>
<a href="<%= config.delete_account_url %>">Delete Account</a><br/>
<% if (config.enable_hitcount == true) { %>
Hitcount: <%= hitcount %>
<% } %>
<%- config.seperator %>

4
views/headers/user.ejs Normal file
View File

@@ -0,0 +1,4 @@
<h1>
<%- user.prettyname %>'s posts
</h1>
<%- config.seperator %>

14
views/pages/post.ejs Normal file
View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); %>
</head>
<body>
<div id="posts">
<%- include('../posts/post'); %>
</div>
<footer>
<%- include('../partials/footer'); %>
</footer>
</body>
</html>

23
views/pages/tag.ejs Normal file
View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); %>
</head>
<body>
<div id="header">
<%- include('../headers/tag'); %>
</div>
<div id="posts">
<% for (let index = posts.length - 1; index >= 0; index--) { %>
<% posts[index].tags.forEach((current_tag, tag_index) => { %>
<% if (current_tag == tag) { %>
<%- include('../posts/tag', {post: posts[index], postID: index}); %>
<% } %>
<% }) %>
<% } %>
</div>
<footer>
<%- include('../partials/footer'); %>
</footer>
</body>
</html>

19
views/pages/timeline.ejs Normal file
View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); %>
</head>
<body>
<div id="header">
<%- include('../headers/timeline'); %>
</div>
<div id="posts">
<% for (let index = posts.length - 1; index >= 0; index--) { %>
<%- include('../posts/timeline', {post: posts[index], index: index, user: users[posts[index].userID]}); %>
<% } %>
</div>
<footer>
<%- include('../partials/footer'); %>
</footer>
</body>
</html>

21
views/pages/user.ejs Normal file
View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); %>
</head>
<body>
<div id="header">
<%- include('../headers/user'); %>
</div>
<div id="posts">
<% for (let index = posts.length - 1; index >= 0; index--) { %>
<% if (posts[index].userID == userID) { %>
<%- include('../posts/user', {post: posts[index], index: index, user: user}); %>
<% } %>
<% } %>
</div>
<footer>
<%- include('../partials/footer'); %>
</footer>
</body>
</html>

View File

@@ -0,0 +1,2 @@
<b><%= comment.name %></b> <%= format(fromUnixTime(comment.pubdate), config.date_format) %> <i>No. <%= comment.id %></i>:<br/>
<%= comment.content %>

View File

@@ -0,0 +1,2 @@
Site is ran by deadvey<br/>
<%- config.attribution %>

8
views/partials/head.ejs Normal file
View File

@@ -0,0 +1,8 @@
<meta charset="<%- config.charset %>">
<title><%= config.site_name %></title>
<style>
</style>
<link rel="stylesheet" href="custom.css">

29
views/posts/post.ejs Normal file
View File

@@ -0,0 +1,29 @@
<h1>
<%= post.title %>
</h1>
<%= post.content %><br/>
<i>
By <a href="/user/<%= user.username %>"><%= user.username %></a><br/>
</i>
<br/>
<%- hyperlink_tags(post.tags) %><br/>
<a href="<%= config.edit_post_base_url %>/<%= postID %>">Edit</a><br/>
<i>Published: <%= format(fromUnixTime(post.pubdate), config.date_format) %></i><br/>
<i>Last Modified: <%= format(fromUnixTime(post.editdate), config.date_format) %></i><br/>
<%- config.seperator %>
<!-- Comment form -->
<form method="POST" action="/submit_comment">
<input type="hidden" name="post_index" value="<%= postID %>">
<input placeholder="username" name="name"><br/>
<textarea placeholder="comment" name="content"></textarea><br/>
<button type="submit">Submit</button>
</form>
<% comments.forEach((comment, postID) => { %>
<%- include('../partials/comment', {comment: comment}) %>
<% }) %>
<%- config.seperator %>

21
views/posts/tag.ejs Normal file
View File

@@ -0,0 +1,21 @@
<h3>
<%= post.title %>
</h3>
<%= post.content %><br/>
<a href="/post/<%- postID %>">Permalink</a><br/>
<%- hyperlink_tags(post.tags) %>
<!-- Comment form -->
<form method="POST" action="/submit_comment">
<input type="hidden" name="post_index" value="<%= postID %>">
<input placeholder="username" name="name"><br/>
<textarea placeholder="comment" name="content"></textarea><br/>
<button type="submit">Submit</button>
</form>
<% comments[postID].forEach((comment) => { %>
<%- include('../partials/comment', {comment: comment}) %>
<% }) %>
<%- config.seperator %>

23
views/posts/timeline.ejs Normal file
View File

@@ -0,0 +1,23 @@
<h3>
<%= post.title %>
</h3>
<%= post.content %><br/>
<a href="/post/<%- index %>">Permalink</a><br/>
<i>
By <a href="/user/<%= user.username %>"><%= user.username %></a><br/>
</i>
<!-- Comment form -->
<form method="POST" action="/submit_comment">
<input type="hidden" name="post_index" value="<%= index %>">
<input placeholder="username" name="name"><br/>
<textarea placeholder="comment" name="content"></textarea><br/>
<button type="submit">Submit</button>
</form>
<% comments[index].forEach((comment, index) => { %>
<%- include('../partials/comment', {comment: comment}) %>
<% }) %>
<%- config.seperator %>

20
views/posts/user.ejs Normal file
View File

@@ -0,0 +1,20 @@
<h3>
<%= post.title %>
</h3>
<%= post.content %><br/>
<a href="/post/<%- index %>">Permalink</a><br/>
<!-- Comment form -->
<form method="POST" action="/submit_comment">
<input type="hidden" name="post_index" value="<%= index %>">
<input placeholder="username" name="name"><br/>
<textarea placeholder="comment" name="content"></textarea><br/>
<button type="submit">Submit</button>
</form>
<% comments[index].forEach((comment, index) => { %>
<%- include('../partials/comment', {comment: comment}) %>
<% }) %>
<%- config.seperator %>