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

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 %>