diff --git a/App/FeatureSet/Home/Utils/BlogPost.ts b/App/FeatureSet/Home/Utils/BlogPost.ts index 9a5ec2b458..e5df8db699 100644 --- a/App/FeatureSet/Home/Utils/BlogPost.ts +++ b/App/FeatureSet/Home/Utils/BlogPost.ts @@ -27,6 +27,9 @@ export interface BlogPost { fileName: string; tags: string[]; postDate: string; + formattedPostDate: string; + socialMediaImageUrl: string; + blogUrl: string; } const GitHubRawUrl = 'https://raw.githubusercontent.com/oneuptime/blog/master' @@ -146,6 +149,7 @@ export default class BlogPostUtil { ); const postDate = this.getPostDateFromFileName(fileName); + const formattedPostDate = this.getFormattedPostDateFromFileName(fileName); const fileData: | HTTPResponse< @@ -193,12 +197,28 @@ export default class BlogPostUtil { markdownBody: markdownContent, fileName, tags, - postDate: postDate, + postDate, + formattedPostDate, + socialMediaImageUrl: `${GitHubRawUrl}/posts/${fileName}/social-media.png`, + blogUrl: `https://oneuptime.com/blog/post/${fileName}`, }; return blogPost; } + static getPostDateFromFileName(fileName: string): string { + const year = fileName.split('-')[0]; + const month = fileName.split('-')[1]; + const day = fileName.split('-')[2]; + + if(!year || !month || !day) { + throw new BadDataException('Invalid file name'); + } + + return `${year}-${month}-${day}`; + } + + static getFormattedPostDateFromFileName(fileName: string): string { // file name is of the format YYYY-MM-DD-Title.md const year = fileName.split('-')[0]; const month = fileName.split('-')[1]; diff --git a/App/FeatureSet/Home/Views/Blog/Post.ejs b/App/FeatureSet/Home/Views/Blog/Post.ejs index 7d886f266d..78b72d30b3 100644 --- a/App/FeatureSet/Home/Views/Blog/Post.ejs +++ b/App/FeatureSet/Home/Views/Blog/Post.ejs @@ -8,11 +8,61 @@ <%= blogPost.title %> - <%- include('../head') -%> + <%- include('../head-basic') -%> + + + + + + + + + + + + + + + + + + + + + - @@ -28,7 +78,7 @@
+
<%= blogPost.description %>
@@ -38,69 +88,78 @@ <%- blogPost.htmlBody -%> - <% if(blogPost.tags.length > 0){ %> -@<%- - blogPost.author.username -%>
+ <% if(blogPost.tags.length> 0){ %> +OneUptime is the complete open-source observability platform.
+OneUptime is the complete observability platform. OneUptime is open-source and always will be.