Skip to content

Commit

Permalink
Add support for setting style settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole Eskild Steensen committed Mar 17, 2023
1 parent be33faa commit f7e92d2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/site/_data/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require("dotenv").config();
const axios = require("axios");
const fs = require("fs");
const crypto = require("crypto");
const {globSync} = require("glob");
const { globSync } = require("glob");

module.exports = async () => {
let baseUrl = process.env.SITE_BASE_URL || "";
Expand All @@ -20,6 +20,9 @@ module.exports = async () => {
title: false,
default: process.env.NOTE_ICON_DEFAULT,
};

const styleSettingsCss = process.env.STYLE_SETTINGS_CSS || "";

if (process.env.NOTE_ICON_TITLE && process.env.NOTE_ICON_TITLE == "true") {
bodyClasses.push("title-note-icon");
noteIconsSettings.title = true;
Expand All @@ -45,6 +48,10 @@ module.exports = async () => {
bodyClasses.push("backlinks-note-icon");
noteIconsSettings.backlinks = true;
}
if(styleSettingsCss){
bodyClasses.push("css-settings-manager");
}

let timestampSettings = {
timestampFormat: process.env.TIMESTAMP_FORMAT || "MMM dd, yyyy h:mm a",
showCreated: process.env.SHOW_CREATED_TIMESTAMP == "true",
Expand All @@ -60,6 +67,7 @@ module.exports = async () => {
baseTheme: process.env.BASE_THEME || "dark",
siteName: process.env.SITE_NAME_HEADER || "Digital Garden",
siteBaseUrl: baseUrl,
styleSettingsCss
};

return meta;
Expand Down
10 changes: 9 additions & 1 deletion src/site/_includes/components/pageheader.njk
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@
{% for name, content in metatags %}
<meta name="{{ name }}" content="{{ content }}">
{% endfor %}
{% endif %}
{% endif %}

{% if meta.styleSettingsCss %}
<style>
{{ meta.styleSettingsCss | safe }}
</style>
{% endif %}
<style>
</style>

0 comments on commit f7e92d2

Please sign in to comment.