Skip to content

Commit

Permalink
Blogroll No Title, Avatar attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofzerbe committed Jul 22, 2024
1 parent a336358 commit 68cbbbe
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ icon: /images/icon-192x192.png
keywords:
author: Kristof Zerbe
photo: /images/kristof-zerbe.png
avatar: /images/kristof-zerbe-400.jpg
email: [email protected]
profiles:
mastodon: https://indieweb.social/@kiko
Expand Down
20 changes: 18 additions & 2 deletions scripts/generators/generator-dynamic-about.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
const log = require('hexo-log')({ debug: false, silent: false });
const { magenta } = require('chalk');
const path = require('path');
const fs = require("hexo-fs");
// const { config } = require('process');

const _rootDir = hexo.source_dir.replace("source", "");

hexo.extend.generator.register("dynamic-about", async function(locals) {
log.info("Generating Dynamic Page " + magenta("ABOUT") + " ...");

let config = this.config;

let result = [];

let page = locals.dynamic.about;

return {
result.push({
data: page,
path: path.join(page.name, "index.html"),
layout: "about"
};
});

// Copy Avatar -> see https://blog.jim-nielsen.com/2023/well-known-avatar/
/* TODO: Doesn't work this way. File has to return a true JPEG from web server */
// log.info("Generating File " + magenta(".well-known/avatar"));
// let source = path.join(_rootDir, config.static_dir, config.avatar);
// let target = path.join(hexo.public_dir, ".well-known/avatar");
// fs.copyFile(source, target);

return result;
});
4 changes: 3 additions & 1 deletion scripts/generators/generator-dynamic-blogroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ hexo.extend.generator.register("dynamic-blogroll", async function(locals) {
let feedItem = json.items[0];
item.latest_post = {
"url": feedItem.url,
"title": feedItem.title,
"title": feedItem.title || "- no title -",
"date_published": feedItem.date_published
};
} else {
Expand Down Expand Up @@ -80,6 +80,8 @@ hexo.extend.generator.register("dynamic-blogroll", async function(locals) {
});

// Render Blogroll OPML by template and add to result
log.info("Generating File " + magenta(config.blogroll.opml_path));

const opmlTemplate = path.join(_rootDir, config.template_dir, config.blogroll.opml_template);
if (!fs.existsSync(opmlTemplate)) { throw "Blogroll OPML template file not found"; }

Expand Down
2 changes: 2 additions & 0 deletions scripts/generators/generator-dynamic-feeds.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ hexo.extend.generator.register("dynamic-feeds", async function(locals) {
});

//Render Feed OPML by template and add to result
log.info("Generating File " + magenta(config.feed.opml_path));

const opmlTemplate = path.join(_rootDir, config.template_dir, config.feed.opml_template);
if (!fs.existsSync(opmlTemplate)) { throw "Feed OPML template file not found"; }

Expand Down
4 changes: 2 additions & 2 deletions scripts/generators/generator-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const sharp = require("sharp");
// const { config } = require("process");

hexo.extend.generator.register("notes", function (locals) {
log.info("Generating Pages for " + magenta("NOTES") + " ...");

let config = this.config;
let notesDir = path.join(config.source_dir, "_" + config.notes_dir);
let currentYear = new Date().getFullYear();

// collection of pages to render
let result = [];

log.info("Generating Pages for " + magenta("NOTES") + " ...");

let years = fs
.readdirSync(notesDir)
.filter((entry) => fs.statSync(path.join(notesDir, entry)).isDirectory())
Expand Down
1 change: 0 additions & 1 deletion scripts/generators/generator-wellknown-webfinger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { magenta } = require('chalk');
const axios = require("axios");

hexo.extend.generator.register("wellknown-webfinger", async function() {

log.info("Generating File " + magenta(".well-known/webfinger"));

let mastodonUrl = this.config.profiles.mastodon.split("@");
Expand Down
2 changes: 1 addition & 1 deletion source/_dynamic/blogroll.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ teaser: >-
Great people who write stuff on the internet that I follow, either on Mastodon
or via feed
date: 2024-06-04 18:29:29
updated: 2024-07-17 21:29:59
updated: 2024-07-22 11:13:28
---

I think everyone who runs a blog also reads a lot of other blogs. So do I. Be it via feed reader or via links in Mastodon posts. Some of these posts that I come across every day are pure gold and inspire me to try out the things mentioned there immediately ... or at least save them in my "must-do" list for later.
Expand Down

0 comments on commit 68cbbbe

Please sign in to comment.