Compare commits
3 Commits
ff1d34a7ab
...
bb62ccf25f
Author | SHA1 | Date | |
---|---|---|---|
bb62ccf25f | |||
40e0cc80a3 | |||
306adf3943 |
12
README.md
12
README.md
@@ -1,8 +1,14 @@
|
|||||||
This is a blogging site written in nodejs, all pages are served directly by the nodejs backend.<br/>
|
This software aims to provide a lot of power to the web admin who is running the blog site.<br/>
|
||||||
And all data is stored in plaintext<br/>
|
Customisation is unlimited with a bit of knowledge of EJS and CSS, you can edit the entire formatting of the pages, making the site truly yours!<br/>
|
||||||
Please don't use this yet, it's not finished<br/>
|
This software also aims to be compatible with text based browsers and as a result contains no client side Javascript, if you're looking for a more<br/>
|
||||||
|
beautiful and featureful blogging frontend, this isn't for you.<br/>
|
||||||
|
|
||||||
|
> [!CAUTION]
|
||||||
|
> This software is not finished yet, so it's very buggy and probably really insecure
|
||||||
|
> use at your own risk!
|
||||||
See the software in action: [deadvey.com](https://deadvey.com)<br/>
|
See the software in action: [deadvey.com](https://deadvey.com)<br/>
|
||||||
|
|
||||||
|
|
||||||
# Confiuration
|
# Confiuration
|
||||||
Read the [configuation guide](docs/CONFIG.md) for configuration help (in config.json)
|
Read the [configuation guide](docs/CONFIG.md) for configuration help (in config.json)
|
||||||
|
|
||||||
|
@@ -69,31 +69,13 @@ app.get(config.rss_url, (req,res) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let rss_content = `<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<rss version="2.0">
|
|
||||||
<channel>
|
|
||||||
<title>${config.site_name}</title>
|
|
||||||
<link>${config.site_url}</link>
|
|
||||||
<description>${config.site_description}</description>
|
|
||||||
`
|
|
||||||
for (let i = posts.length-1; i >= 0; i--) {
|
|
||||||
rss_content += `
|
|
||||||
<item>
|
|
||||||
<title>${posts[i]["title"]}</title>
|
|
||||||
<link>${config.site_url}/post/${i}</link>
|
|
||||||
<description><![CDATA[${converter.makeHtml(posts[i]["content"])}]]></description>
|
|
||||||
<guid isPermaLink="true">${config.site_url}/post/${i}</guid>
|
|
||||||
<pubDate>${func.unix_time_to_rss_date(posts[i]['pubdate'])}</pubDate>`
|
|
||||||
for (let j = 0; j < posts[i]['tags'].length; j++) {
|
|
||||||
rss_content += `<category><![CDATA[${posts[i]['tags'][j]}]]></category>`
|
|
||||||
};
|
|
||||||
rss_content += "</item>"
|
|
||||||
}
|
|
||||||
rss_content += `
|
|
||||||
</channel>
|
|
||||||
</rss>`
|
|
||||||
res.setHeader('content-type', 'application/rss+xml');
|
res.setHeader('content-type', 'application/rss+xml');
|
||||||
res.send(rss_content)
|
res.render("syndication/rss", {
|
||||||
|
config,
|
||||||
|
posts,
|
||||||
|
converter,
|
||||||
|
func,
|
||||||
|
})
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -119,6 +101,7 @@ app.get("/", (req,res) => {
|
|||||||
format,
|
format,
|
||||||
getUnixTime,
|
getUnixTime,
|
||||||
func,
|
func,
|
||||||
|
converter,
|
||||||
})
|
})
|
||||||
}); // /
|
}); // /
|
||||||
app.get("/user/:username", (req, res) => {
|
app.get("/user/:username", (req, res) => {
|
||||||
@@ -136,6 +119,7 @@ app.get("/user/:username", (req, res) => {
|
|||||||
format: format,
|
format: format,
|
||||||
getUnixTime: getUnixTime,
|
getUnixTime: getUnixTime,
|
||||||
func,
|
func,
|
||||||
|
converter,
|
||||||
})
|
})
|
||||||
}); // /user/:username
|
}); // /user/:username
|
||||||
app.get("/post/:post_index", (req, res) => {
|
app.get("/post/:post_index", (req, res) => {
|
||||||
@@ -151,6 +135,7 @@ app.get("/post/:post_index", (req, res) => {
|
|||||||
format,
|
format,
|
||||||
getUnixTime,
|
getUnixTime,
|
||||||
func,
|
func,
|
||||||
|
converter,
|
||||||
})
|
})
|
||||||
}); // /post/:post_index
|
}); // /post/:post_index
|
||||||
app.get("/tag/:tag", (req,res) => {
|
app.get("/tag/:tag", (req,res) => {
|
||||||
@@ -166,6 +151,7 @@ app.get("/tag/:tag", (req,res) => {
|
|||||||
format: format,
|
format: format,
|
||||||
getUnixTime: getUnixTime,
|
getUnixTime: getUnixTime,
|
||||||
func,
|
func,
|
||||||
|
converter,
|
||||||
})
|
})
|
||||||
}); // /tag/:tag
|
}); // /tag/:tag
|
||||||
|
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
<h1>
|
<h1>
|
||||||
<%= post.title %>
|
<%= post.title %>
|
||||||
</h1>
|
</h1>
|
||||||
<%= post.content %><br/>
|
<%- converter.makeHtml(post.content) %><br/>
|
||||||
<i>
|
<i>
|
||||||
By <a href="/user/<%= user.username %>"><%= user.username %></a><br/>
|
By <a href="/user/<%= user.username %>"><%= user.username %></a><br/>
|
||||||
</i>
|
</i>
|
||||||
<br/>
|
|
||||||
<%- func.hyperlink_tags(post.tags) %><br/>
|
<%- func.hyperlink_tags(post.tags) %><br/>
|
||||||
<a href="<%= config.edit_post_base_url %>/<%= postID %>">Edit</a><br/>
|
<a href="<%= config.edit_post_base_url %>/<%= postID %>">Edit</a><br/>
|
||||||
<i>Published: <%= func.unix_time_to_date_format(post.pubdate) %></i><br/>
|
<i>Published: <%= func.unix_time_to_date_format(post.pubdate) %></i><br/>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<h3>
|
<h3>
|
||||||
<%= post.title %>
|
<%= post.title %>
|
||||||
</h3>
|
</h3>
|
||||||
<%= post.content %><br/>
|
<%- converter.makeHtml(post.content) %><br/>
|
||||||
<a href="/post/<%- postID %>">Permalink</a><br/>
|
<a href="/post/<%- postID %>">Permalink</a><br/>
|
||||||
<%- func.hyperlink_tags(post.tags) %>
|
<%- func.hyperlink_tags(post.tags) %>
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<h3>
|
<h3>
|
||||||
<%= post.title %>
|
<%= post.title %>
|
||||||
</h3>
|
</h3>
|
||||||
<%= post.content %><br/>
|
<%- converter.makeHtml(post.content) %><br/>
|
||||||
<a href="/post/<%- index %>">Permalink</a><br/>
|
<a href="/post/<%- index %>">Permalink</a><br/>
|
||||||
<i>
|
<i>
|
||||||
By <a href="/user/<%= user.username %>"><%= user.username %></a><br/>
|
By <a href="/user/<%= user.username %>"><%= user.username %></a><br/>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<h3>
|
<h3>
|
||||||
<%= post.title %>
|
<%= post.title %>
|
||||||
</h3>
|
</h3>
|
||||||
<%= post.content %><br/>
|
<%- converter.makeHtml(post.content) %><br/>
|
||||||
<a href="/post/<%- index %>">Permalink</a><br/>
|
<a href="/post/<%- index %>">Permalink</a><br/>
|
||||||
|
|
||||||
<!-- Comment form -->
|
<!-- Comment form -->
|
||||||
|
20
views/syndication/rss.ejs
Normal file
20
views/syndication/rss.ejs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="<%= config.charset %>" ?>
|
||||||
|
<rss version="2.0">
|
||||||
|
<channel>
|
||||||
|
<title><%= config.site_name %></title>
|
||||||
|
<link><%= config.site_url %></title>
|
||||||
|
<description><%= config.site_description %></description>
|
||||||
|
<% for (let postID = posts.length-1; postID >= 0; postID--) { %>
|
||||||
|
<item>
|
||||||
|
<title><%= posts[postID]["title"] %></title>
|
||||||
|
<link><%= config.site_url %>/post/<%= postID %></link>
|
||||||
|
<description><![CDATA[<%= converter.makeHtml(posts[postID]["content"]) %>]]></description>
|
||||||
|
<guid isPermaLink="true"><%= config.site_url %>/post/<%= postID %></guid>
|
||||||
|
<pubDate><%= func.unix_time_to_rss_date(posts[postID]['pubdate']) %></pubDate>
|
||||||
|
<% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %>
|
||||||
|
<category><![CDATA[<%= posts[postID]['tags'][tag_index] %>]]></category>
|
||||||
|
<% } %>
|
||||||
|
</item>
|
||||||
|
<% } %>
|
||||||
|
</channel>
|
||||||
|
</rss>
|
Reference in New Issue
Block a user