diff --git a/Makefile b/Makefile index 5ee812e..47f0da3 100644 --- a/Makefile +++ b/Makefile @@ -67,14 +67,18 @@ $(DISTDIR)/sitemap.xml: $(HTMLFILES) done @echo '' >> $@ -$(DISTDIR)/blogindex.txt: $(HTMLFILES) +$(DISTDIR)/blogindex.txt: $(MDFILES) @> $@ @for f in $^; do \ - uri="$(URI)$${f#$(DISTDIR)}"; \ + uri="$(URI)$${f#$(SRCDIR)}"; \ if [[ "$$uri" == "$(URI)/blog/"* ]]; then \ - echo "$$uri" >> $@; \ + creation_date=$$(stat -c %Y $$f); \ + uri=$$(echo "$$uri" | sed 's/\.md$$/.html/'); \ + echo "$$creation_date $$uri" >> $@; \ fi; \ done + @sort -n -k1 -o $@ $@ + .PHONY: clean clean: rm -rfv $(DISTDIR)/* diff --git a/dist/404.html b/dist/404.html index 5542faa..1e5e43f 100644 --- a/dist/404.html +++ b/dist/404.html @@ -10,6 +10,7 @@ +
@@ -26,7 +27,7 @@

404: Not Found

+ href="xertun.webp">

diff --git a/dist/blog/firstPost.html b/dist/blog/firstPost.html index a280f21..8fc717d 100644 --- a/dist/blog/firstPost.html +++ b/dist/blog/firstPost.html @@ -10,6 +10,7 @@ +
diff --git a/dist/blog/index.html b/dist/blog/index.html index b1a1487..5e0996e 100644 --- a/dist/blog/index.html +++ b/dist/blog/index.html @@ -10,6 +10,7 @@ +
@@ -24,12 +25,17 @@

Page last modified: January 26, 2024

-

Index of blog posts:

+

(Sorted by date created)

+
+ JavaScript must be enabled for the blog index to work. Otherwise visit blogindex.txt for a plaintext list. +
JavaScript must be enabled for the blog index to work. Otherwise visit blogindex.txt for a plaintext list.
- - +

+

diff --git a/dist/blogIndex.min.js b/dist/blogIndex.min.js index 4cd0105..8f15bcc 100644 --- a/dist/blogIndex.min.js +++ b/dist/blogIndex.min.js @@ -1 +1 @@ -function blogIndex(){document.getElementById("blogIndex").innerHTML=null,fetch("/blogindex.txt").then(n=>n.text()).then(n=>{n=n.split("\n");const t=document.createElement("ul");n.forEach(n=>{var o,e,l=n.split("/").pop().replace(".html","");"index"!==l.toLowerCase()&&(o=document.createElement("li"),(e=document.createElement("a")).href=n.substring(n.indexOf("/blog/")),e.textContent=l,o.appendChild(e),t.appendChild(o))}),document.getElementById("blogIndex").appendChild(t)}).catch(n=>{console.error("Error fetching blog index:",n)})} \ No newline at end of file +function convertCamelCaseToReadable(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/(\d{4}-\d{2}-\d{2})/g," $1").replace(/\b\w/g,e=>e.toUpperCase())}function blogIndex(){document.getElementById("blogIndex").innerHTML=null,document.getElementById("latestPost").innerHTML=null,fetch("/blogindex.txt").then(e=>e.text()).then(e=>{e=e.split("\n").filter(e=>""!==e.trim()).map(e=>{e=e.split(" ");return{timestamp:parseInt(e[0]),uri:e[1]||""}});e.sort((e,n)=>n.timestamp-e.timestamp);const l=document.createElement("ul");e.forEach(e=>{var n,o,t;e.uri&&(n=convertCamelCaseToReadable(o=e.uri.split("/").pop().replace(".html","")),"index"!==o.toLowerCase())&&(o=document.createElement("li"),(t=document.createElement("a")).href=e.uri.substring(e.uri.indexOf("/blog/")),t.textContent=n,o.appendChild(t),l.appendChild(o))}),document.getElementById("blogIndex").appendChild(l)}).catch(e=>{console.error("Error fetching and processing blog index:",e)})} \ No newline at end of file diff --git a/dist/blogindex.txt b/dist/blogindex.txt index 399be8f..729048d 100644 --- a/dist/blogindex.txt +++ b/dist/blogindex.txt @@ -1,2 +1,2 @@ -https://bear.oops.wtf/blog/index.html -https://bear.oops.wtf/blog/firstPost.html +1706393547 https://bear.oops.wtf/blog/firstPost.html +1706393752 https://bear.oops.wtf/blog/index.html diff --git a/dist/coolLinks.html b/dist/coolLinks.html new file mode 100644 index 0000000..243226c --- /dev/null +++ b/dist/coolLinks.html @@ -0,0 +1,32 @@ + + + + + + + + Blog Index + + + + + + + +
+ +
+

BEAR.OOPS.WTF

+
+

Page created: January 26, 2024

+

Page last modified: January 26, 2024

+
+ + + diff --git a/dist/css/blogIndex.css b/dist/css/blogIndex.css new file mode 100644 index 0000000..89500ce --- /dev/null +++ b/dist/css/blogIndex.css @@ -0,0 +1 @@ +.article{text-align:center} diff --git a/dist/css/center.css b/dist/css/center.css new file mode 100644 index 0000000..89500ce --- /dev/null +++ b/dist/css/center.css @@ -0,0 +1 @@ +.article{text-align:center} diff --git a/dist/css/style.css b/dist/css/style.css index d985e03..debf8c8 100644 --- a/dist/css/style.css +++ b/dist/css/style.css @@ -1 +1 @@ -@import "https://fonts.googleapis.com/icon?family=Material+Icons";body{font-family:Arial, sans-serif;font-size:1.5em;margin:2em;line-height:1.6;height:100vh;width:auto;margin:0;padding:0;text-align:center;background-color:#282828;color:#ebdbb2}.error-image{display:block;margin-left:auto;margin-right:auto}.meta{font-size:0.75em;line-height:1;color:#504945}.center-box{text-align:left;width:15%;margin:auto}header{background-color:#3c3836;color:#ebdbb2}header a{color:#ebdbb2;text-decoration:dotted;font-size:1.5rem}header a i{vertical-align:middle;display:inline-block}nav{background-color:#504945;color:#ebdbb2;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:6px}.title{font-weight:bolder}.article{width:auto;margin:0 auto;margin-top:0%;text-align:justify;width:30vw}.article h1,.article h2,.article h3,.article h4,.article h5,.article h6{text-align:center}ul,li,ol{margin:0;padding:0;list-style:none}h1,h2,h3,h4,h5,h6{color:#fbf1c7}a{color:#458588}a:hover{color:#689d6a}button{background-color:#b16286;color:#fbf1c7}button:hover{background-color:#458588}p{margin-bottom:1em}pre{background-color:#504945;padding:0.5em;overflow:auto}code{font-family:'Courier New', Courier, monospace;background-color:#504945;color:#d65d0e;padding:0.2em;border-radius:3px}table{border-collapse:collapse;width:100%;margin-bottom:1em;border-collapse:collapse}table th,table td{border:1px solid #3c3836;padding:8px;text-align:left}th,td{border:1px solid #fbf1c7;padding:8px;text-align:left}th{background-color:#ebdbb2}blockquote{border-left:2px solid #504945;margin:1em 0;padding-left:1em}footer{background-color:#3c3836;color:#d5c4a1} +@import "https://fonts.googleapis.com/icon?family=Material+Icons";body{font-family:Arial, sans-serif;font-size:1.5em;margin:2em;line-height:1.6;height:100vh;width:auto;margin:0;padding:0;text-align:center;background-color:#282828;color:#ebdbb2}.center-image{display:block;margin-left:auto;margin-right:auto}.meta{font-size:0.75em;line-height:1;color:#504945}.center-box{text-align:left;width:15%;margin:auto}header{background-color:#3c3836;color:#ebdbb2}header a{color:#ebdbb2;text-decoration:dotted;font-size:1.5rem}header a i{vertical-align:middle;display:inline-block}nav{background-color:#504945;color:#ebdbb2;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:6px}.title{font-weight:bolder}.article{width:auto;margin:0 auto;margin-top:0%;text-align:justify;width:30vw}.article h1,.article h2,.article h3,.article h4,.article h5,.article h6{text-align:center}ul,li,ol{margin:0;padding:0;list-style:none}h1,h2,h3,h4,h5,h6{color:#fbf1c7}a{color:#458588}a:hover{color:#689d6a}button{background-color:#b16286;color:#fbf1c7}button:hover{background-color:#458588}p{margin-bottom:1em}pre{background-color:#504945;padding:0.5em;overflow:auto}code{font-family:'Courier New', Courier, monospace;background-color:#504945;color:#d65d0e;padding:0.2em;border-radius:3px}table{border-collapse:collapse;width:100%;margin-bottom:1em;border-collapse:collapse}table th,table td{border:1px solid #3c3836;padding:8px;text-align:left}th,td{border:1px solid #fbf1c7;padding:8px;text-align:left}th{background-color:#ebdbb2}blockquote{border-left:2px solid #504945;margin:1em 0;padding-left:1em}footer{background-color:#3c3836;color:#d5c4a1} diff --git a/dist/download/88x31.png b/dist/download/88x31.png new file mode 100644 index 0000000..252de28 Binary files /dev/null and b/dist/download/88x31.png differ diff --git a/dist/git/index.html b/dist/git/index.html index a21fe10..e425b1e 100644 --- a/dist/git/index.html +++ b/dist/git/index.html @@ -10,6 +10,7 @@ +
@@ -24,8 +25,8 @@

Page last modified: January 26, 2024

-

This is supposed to be the location of a Gitea, the webserver - is likely misconfigured…

+

This is supposed to be the location of a Gitea instance, the + webserver is likely misconfigured…

Until next time…

diff --git a/dist/index.html b/dist/index.html index e697015..f009be9 100644 --- a/dist/index.html +++ b/dist/index.html @@ -10,6 +10,7 @@ +
@@ -27,6 +28,7 @@

Hello, I’m Bear.

Cool Links

Git

+

Blog Posts

diff --git a/dist/sitemap.xml b/dist/sitemap.xml index 5b6401b..d736fab 100644 --- a/dist/sitemap.xml +++ b/dist/sitemap.xml @@ -4,4 +4,5 @@ https://bear.oops.wtf/blog/index.html https://bear.oops.wtf/blog/firstPost.html https://bear.oops.wtf/git/index.html +https://bear.oops.wtf/coolLinks.html diff --git a/js/blogIndex.js b/js/blogIndex.js index 7245c84..0090cac 100644 --- a/js/blogIndex.js +++ b/js/blogIndex.js @@ -1,30 +1,63 @@ +function convertCamelCaseToReadable(text) { + return text + .replace(/([a-z])([A-Z])/g, '$1 $2') // Convert camelCase to separate words + .replace(/(\d{4}-\d{2}-\d{2})/g, ' $1') // Add space before date-like patterns + .replace(/\b\w/g, c => c.toUpperCase()); // Capitalize each word +} + function blogIndex() { document.getElementById('blogIndex').innerHTML = null; + document.getElementById('latestPost').innerHTML = null; + fetch('/blogindex.txt') - .then(response => response.text()) .then(data => { - const uriList = data.split('\n'); - const ulElement = document.createElement('ul'); + // Split the data into an array of timestamped URIs + const uriList = data.split('\n'); + + // Remove any empty lines + const filteredUriList = uriList.filter(entry => entry.trim() !== ''); + + // Create an array of objects with timestamp and URI properties + const entries = filteredUriList.map(entry => { + const parts = entry.split(' '); + return { timestamp: parseInt(parts[0]), uri: parts[1] || '' }; + }); + + // Sort the entries by timestamp in descending order (latest first) + entries.sort((a, b) => b.timestamp - a.timestamp); + + // Create an unordered list element + const ulElement = document.createElement('ul'); + + // Iterate through the sorted entries and extract pretty names, excluding the index page + entries.forEach(entry => { + // Check if the URI is defined before processing + if (entry.uri) { + // Extract the file name without extension + const fileName = entry.uri.split('/').pop().replace('.html', ''); - uriList.forEach(uri => { - const name = uri.split('/').pop().replace('.html', ''); - - if (name.toLowerCase() !== 'index') { - const liElement = document.createElement('li'); - const aElement = document.createElement('a'); - - aElement.href = uri.substring(uri.indexOf('/blog/')); - aElement.textContent = name; - liElement.appendChild(aElement); - ulElement.appendChild(liElement); - } - }); - - document.getElementById('blogIndex').appendChild(ulElement); + const readableName = convertCamelCaseToReadable(fileName); + + // Exclude the index page + if (fileName.toLowerCase() !== 'index') { + // Create list items with links using relative paths + const liElement = document.createElement('li'); + const aElement = document.createElement('a'); + // Use a relative link instead of the full URI + aElement.href = entry.uri.substring(entry.uri.indexOf('/blog/')); + aElement.textContent = readableName; + liElement.appendChild(aElement); + ulElement.appendChild(liElement); + } + } + }); + + // Append the unordered list to the blogIndex div + document.getElementById('blogIndex').appendChild(ulElement); }) .catch(error => { - console.error('Error fetching blog index:', error); + console.error('Error fetching and processing blog index:', error); }); } \ No newline at end of file diff --git a/src/404.md b/src/404.md index c2a18c5..9fd8acb 100644 --- a/src/404.md +++ b/src/404.md @@ -3,8 +3,9 @@ title: 404 - Not Found author: BearFM date: January 25, 2024 modified: January 25, 2024 +header: --- # 404: Not Found -[](xertun.webp) \ No newline at end of file +[](xertun.webp) \ No newline at end of file diff --git a/src/blog/firstPost.md b/src/blog/firstPost.md index 2526d07..5c59416 100644 --- a/src/blog/firstPost.md +++ b/src/blog/firstPost.md @@ -3,6 +3,7 @@ title: First Post author: BearFM date: January 26, 2024 modified: January 26, 2024 +header: --- wowzers first post diff --git a/src/blog/index.md b/src/blog/index.md index 5098886..55a1b68 100644 --- a/src/blog/index.md +++ b/src/blog/index.md @@ -3,13 +3,19 @@ title: Blog Index author: BearFM date: January 26, 2024 modified: January 26, 2024 +header: --- -Index of blog posts: +(Sorted by date created) + +
+ JavaScript must be enabled for the blog index to work. Otherwise visit blogindex.txt for a plaintext list. +
+
JavaScript must be enabled for the blog index to work. Otherwise visit blogindex.txt for a plaintext list.
- - \ No newline at end of file +[](blogIndex.min.js) +[]() \ No newline at end of file diff --git a/src/coolLinks.md b/src/coolLinks.md new file mode 100644 index 0000000..bf702ac --- /dev/null +++ b/src/coolLinks.md @@ -0,0 +1,11 @@ +--- +title: Blog Index +author: BearFM +date: January 26, 2024 +modified: January 26, 2024 +header: +--- + +Pages I think are cool: + +[Crony's Page](https://cronyakatsuki.xyz/) \ No newline at end of file diff --git a/src/git/index.md b/src/git/index.md index 60477e6..0f5c01f 100644 --- a/src/git/index.md +++ b/src/git/index.md @@ -3,8 +3,9 @@ title: You shouldn't be here... author: BearFM date: January 26, 2024 modified: January 26, 2024 +header: --- -This is supposed to be the location of a Gitea, the webserver is likely misconfigured... +This is supposed to be the location of a Gitea instance, the webserver is likely misconfigured... Until next time... \ No newline at end of file diff --git a/src/index.md b/src/index.md index 7b77db3..bc3114c 100644 --- a/src/index.md +++ b/src/index.md @@ -3,10 +3,13 @@ title: bear.oops.wtf author: BearFM date: January 6, 2024 modified: January 25, 2024 +header: --- Hello, I'm Bear. [Cool Links](/coollinks) -[Git](/git) \ No newline at end of file +[Git](/git) + +[Blog Posts](/blog) \ No newline at end of file diff --git a/src/scss/center.scss b/src/scss/center.scss new file mode 100644 index 0000000..61050dd --- /dev/null +++ b/src/scss/center.scss @@ -0,0 +1,3 @@ +.article { + text-align: center; +} \ No newline at end of file diff --git a/src/scss/style.scss b/src/scss/style.scss index db61141..0e6ade1 100644 --- a/src/scss/style.scss +++ b/src/scss/style.scss @@ -50,7 +50,7 @@ body { color: $gruvbox-fg; } -.error-image { +.center-image { display: block; margin-left: auto; margin-right: auto; diff --git a/src/tmpl.html b/src/tmpl.html index b6e6026..070ca33 100644 --- a/src/tmpl.html +++ b/src/tmpl.html @@ -10,6 +10,7 @@ + $header$
diff --git a/static/download/88x31.png b/static/download/88x31.png new file mode 100644 index 0000000..252de28 Binary files /dev/null and b/static/download/88x31.png differ