Skip to content

Commit

Permalink
feat Site: add blog cover image support
Browse files Browse the repository at this point in the history
  • Loading branch information
prplwtf committed May 29, 2024
1 parent 65440c7 commit 0944b90
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion configuration/Configuration.example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Application:
Information:
Title: writea
Description: Writea is an open-source alternative for blogs, allowing for easy page configuration and ultimate flexibility.
Link: github.com/prplwtf/writea
Expand Down
2 changes: 1 addition & 1 deletion configuration/Posts.example.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- Title: Introducing writea, a new way to write blogs.
Description: Lorem ipsum or whatever
Topic: product release
Thumbnail: https://i.imgur.com/MAj12Va.jpg
Thumbnail: writea.jpg
Content: gravity-introduction.md

- Title: Meet Nebula - Pterodactyl takes flight!
Expand Down
3 changes: 2 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var Timestamp = Math.round(Date.now() / 240000)
document.addEventListener("DOMContentLoaded", (async () => {
// Register global variables
var App = document.getElementById("App")
Expand All @@ -14,5 +15,5 @@ document.addEventListener("DOMContentLoaded", (async () => {
clearInterval(interval);

Route(window.location.hash)
}, 10);
}, 10);
}))
4 changes: 2 additions & 2 deletions src/components/elements/LinkElement.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function LinkElement() {
if(!window.Configuration.Application.Link) return;
if(!window.Configuration.Information.Link) return;

let Link = window.Configuration.Application.Link
let Link = window.Configuration.Information.Link
.replace("http://", "")
.replace("https://", "")

Expand Down
4 changes: 2 additions & 2 deletions src/components/elements/NavigationBarElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ function NavigationBarElement() {
${ConfigurationReminder}
<div class="row mb-3">
<div class="col me-auto">
<h3 class="fw-bolder text-danger-emphasis text-truncate" onclick="Route('#')" style='cursor: pointer;'>
${window.Configuration.Application.Title || "gravity"}
<h3 class="fw-bolder text-danger-emphasis text-truncate mb-0 mt-2" onclick="Route('#')" style='cursor: pointer;'>
${window.Configuration.Information.Title || "writea"}
</h3>
</div>
<div class="col-auto">
Expand Down
2 changes: 1 addition & 1 deletion src/components/elements/posts/BlogListElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function BlogListSection() {
if (Post.Thumbnail) {
PostThumbnail = `
<div class="col-12">
<img src="${Post.Thumbnail}"/>
<img src="${Post.Thumbnail}" class="col-12 rounded-2 mb-3 object-fit-cover" height="90px" width="100%"/>
</div>
`
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/sections/AboutSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ function AboutSection() {
return `
${NavigationBarElement()}
<p>
<code>writea</code> is a free, open-source and simplistic alternative for blogs
<span class="text-danger-emphasis">
<i class="bi bi-cup-hot-fill"></i>
writea
</span>
is a free, open-source and simplistic alternative for blogs
- made with pure HTML and JavaScript.
</p>
<a href="https://github.com/prplwtf/writea" target="_blank">
Expand Down
2 changes: 1 addition & 1 deletion src/components/sections/RootSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function RootSection() {
return `
${NavigationBarElement()}
<p>
${window.Configuration.Application.Description || "no description provided"}
${window.Configuration.Information.Description || "no description provided"}
</p>
<div class="row">
${ConnectionElement(
Expand Down
6 changes: 3 additions & 3 deletions src/configuration/FetchBlogs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let BlogsURL = "./configuration/Posts.yml"
let BlogsURL = `./configuration/Posts.yml?v=${Timestamp}`
let ExampleBlogs = false

async function FetchBlogs() {
Expand All @@ -11,9 +11,9 @@ async function FetchBlogs() {
return;
}
if (xhr.readyState == 4 && xhr.status == 404) {
if(BlogsURL != "./configuration/Posts.example.yml") {
if(!ExampleBlogs) {
ExampleBlogs = true
BlogsURL = "./configuration/Posts.example.yml"
BlogsURL = `./configuration/Posts.example.yml?v=${Timestamp}`
FetchBlogs()
} else {
return console.error("Posts.yml could not be found!")
Expand Down
6 changes: 3 additions & 3 deletions src/configuration/FetchConfiguration.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let ConfigurationURL = "./configuration/Configuration.yml"
let ConfigurationURL = `./configuration/Configuration.yml?v=${Timestamp}`
let ExampleConfiguration = false

async function FetchConfiguration() {
Expand All @@ -12,9 +12,9 @@ async function FetchConfiguration() {
return;
}
if (xhr.readyState == 4 && xhr.status == 404) {
if(ConfigurationURL != "./configuration/Configuration.example.yml") {
if(!ExampleConfiguration) {
ExampleConfiguration = true
ConfigurationURL = "./configuration/Configuration.example.yml"
ConfigurationURL = `./configuration/Configuration.example.yml?v=${Timestamp}`
FetchConfiguration()
} else {
await RenderConfiguration()
Expand Down
2 changes: 1 addition & 1 deletion src/configuration/RenderConfiguration.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
async function RenderConfiguration() {
// Render values
AppTitle.innerHTML = window.Configuration.Application.Title || "gravity"
AppTitle.innerHTML = window.Configuration.Information.Title || "writea"
return;
}
Binary file added writea.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0944b90

Please sign in to comment.