diff --git a/frontend/pages/article.ejs b/frontend/pages/article.ejs index d8dbeb8..6615cc7 100644 --- a/frontend/pages/article.ejs +++ b/frontend/pages/article.ejs @@ -23,7 +23,7 @@
Tags: <% for (tag of article.tags) { %><%= toTitleCase(tag) %> <% } %>
+ <% if (article.tags != null) { %>Tags: <% for (tag of article.tags) { %><%= toTitleCase(tag) %> <% } %>
<% } %> <% } %> diff --git a/frontend/pages/artwork.ejs b/frontend/pages/artwork.ejs index d3fe49b..e2755c6 100644 --- a/frontend/pages/artwork.ejs +++ b/frontend/pages/artwork.ejs @@ -21,7 +21,7 @@Tags: <% for (tag of artwork.tags) { %><%= toTitleCase(tag) %> <% } %>
+ <% if (artwork.tags != null) { %>Tags: <% for (tag of artwork.tags) { %><%= toTitleCase(tag) %> <% } %>
<% } %><%= article.tags[0] %> / <% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %>
+<% if (article.tags != null) { %><%= article.tags[0] %> / <% } %><% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %>
<% } %> @@ -60,7 +60,7 @@<%= artwork.tags[0] %> / <% var date = new Date(artwork.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((artwork.author != "") && (artwork.author != null)) { %> / <%= artwork.author %><% } %>
+<% if (artwork.tags != null) { %><%= artwork.tags[0] %> / <% } %><% var date = new Date(artwork.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((artwork.author != "") && (artwork.author != null)) { %> / <%= artwork.author %><% } %>
<% } %> diff --git a/frontend/pages/search.ejs b/frontend/pages/search.ejs index 34fd9f6..417eee7 100644 --- a/frontend/pages/search.ejs +++ b/frontend/pages/search.ejs @@ -61,7 +61,7 @@<%= article.tags[0] %> / <% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %>
+<% if (tags != null) { %><%= article.tags[0] %> / <% } %><% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %>
<% }); %> @@ -92,7 +92,7 @@<%= article.tags[0] %> / <% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %>
+<% if (artwork.tags != null) { %><%= artwork.tags[0] %> / <% } %><% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %>
<% }); %> diff --git a/frontend/pages/tag.ejs b/frontend/pages/tag.ejs index 8f57501..39b6513 100644 --- a/frontend/pages/tag.ejs +++ b/frontend/pages/tag.ejs @@ -3,7 +3,11 @@ <%- include('../partials/head.ejs'); %> <% const filteredArticles = cms.articles.filter(article => { - return article.tags.includes(tag); + if (article.tags == null) { + return false; + } else { + return article.tags.includes(tag); + }; }); function ifYesterday(date) { var yesterday = new Date(); @@ -28,7 +32,7 @@<%= article.tags[0] %> / <% var date = new Date(article._created * 1000); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %>
+<% if (article.tags != null) { %><%= article.tags[0] %> / <% } %><% var date = new Date(article._created * 1000); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %>
<% }); } else { %>No articles found<% } %> diff --git a/frontend/pages/tags.ejs b/frontend/pages/tags.ejs index 0dc2da9..34ae1ac 100644 --- a/frontend/pages/tags.ejs +++ b/frontend/pages/tags.ejs @@ -9,11 +9,13 @@ } var tags = {}; for (article of cms.articles) { - for (tag of article.tags) { - if (!tags[tag]) { - tags[tag] = []; + if (article.tags) { + for (tag of article.tags) { + if (!tags[tag]) { + tags[tag] = []; + }; + tags[tag].push(article); }; - tags[tag].push(article); }; }; function toTitleCase(str) { diff --git a/frontend/partials/suggested.ejs b/frontend/partials/suggested.ejs index 88c46df..4fe6c5d 100644 --- a/frontend/partials/suggested.ejs +++ b/frontend/partials/suggested.ejs @@ -14,7 +14,7 @@ function ifYesterday(date) {<%= article.tags[0] %> / <% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %>
+<% if (article.tags != null) { %><%= article.tags[0] %> / <% } %><% var date = new Date(article.date); if (date.isToday()) { %>Today<% } else if (ifYesterday(date)) { %>Yesterday<% } else { %><%= date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %><% } %><% if ((article.author != "") && (article.author != null)) { %> / <%= article.author %><% } %>
<% } %>