mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-04 12:00:02 +00:00
single homepage rendering (#88)
This commit is contained in:
parent
6698edf262
commit
809118c68b
@ -180,6 +180,9 @@ module.exports = function (eleventyConfig) {
|
||||
if (frontMatter.data.permalink) {
|
||||
permalink = frontMatter.data.permalink;
|
||||
}
|
||||
if (frontMatter.data.tags.indexOf("gardenEntry") != -1) {
|
||||
permalink = "/";
|
||||
}
|
||||
if (frontMatter.data.noteIcon) {
|
||||
noteIcon = frontMatter.data.noteIcon;
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
{
|
||||
"filesToDelete": [
|
||||
"src/site/styles/style.css"
|
||||
"src/site/styles/style.css",
|
||||
"src/site/index.njk",
|
||||
"src/site/index.11tydata.js"
|
||||
],
|
||||
"filesToAdd": [
|
||||
"src/site/styles/custom-style.scss",
|
||||
@ -10,7 +12,8 @@
|
||||
"src/site/img/tree-1.svg",
|
||||
"src/site/img/tree-2.svg",
|
||||
"src/site/img/tree-3.svg",
|
||||
"src/helpers/userUtils.js"
|
||||
"src/helpers/userUtils.js",
|
||||
"src/site/_includes/layouts/index.njk"
|
||||
],
|
||||
"filesToModify": [
|
||||
".eleventy.js",
|
||||
@ -20,9 +23,7 @@
|
||||
"package-lock.json",
|
||||
"package.json",
|
||||
"src/site/404.njk",
|
||||
"src/site/index.njk",
|
||||
"src/site/sitemap.njk",
|
||||
"src/site/index.11tydata.js",
|
||||
"src/site/versionednote.njk",
|
||||
"src/site/styles/style.scss",
|
||||
"src/site/styles/digital-garden-base.scss",
|
||||
@ -30,6 +31,7 @@
|
||||
"src/site/notes/notes.json",
|
||||
"src/site/notes/notes.11tydata.js",
|
||||
"src/site/_includes/layouts/note.njk",
|
||||
"src/site/_includes/layouts/index.njk",
|
||||
"src/site/_includes/layouts/versionednote.njk",
|
||||
"src/site/_includes/components/notegrowthhistory.njk",
|
||||
"src/site/_includes/components/pageheader.njk",
|
||||
|
@ -52,6 +52,9 @@ function getPermalinkMeta(path, key) {
|
||||
if (frontMatter.data.permalink) {
|
||||
permalink = frontMatter.data.permalink;
|
||||
}
|
||||
if (frontMatter.data.tags.indexOf("gardenEntry") != -1) {
|
||||
permalink = "/";
|
||||
}
|
||||
if (frontMatter.data.title) {
|
||||
name = frontMatter.data.title;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{{ noteTitle }}</title>
|
||||
<title>{% if title %}{{ title }}{% else %}{{ page.fileSlug }}{% endif %}</title>
|
||||
{%include "components/pageheader.njk"%}
|
||||
{% for imp in dynamics.common.head %}
|
||||
{% include imp %}
|
||||
@ -52,9 +52,7 @@
|
||||
{% for imp in dynamics.index.beforeContent %}
|
||||
{% include imp %}
|
||||
{% endfor %}
|
||||
{%- for garden in collections.gardenEntry -%}
|
||||
{{garden.templateContent | hideDataview | link | taggify | safe }}
|
||||
{%- endfor -%}
|
||||
{{ content | hideDataview | link | taggify | safe}}
|
||||
{% for imp in dynamics.common.afterContent %}
|
||||
{% include imp %}
|
||||
{% endfor %}
|
@ -1,59 +0,0 @@
|
||||
require("dotenv").config();
|
||||
const settings = require("../helpers/constants");
|
||||
|
||||
const markdownIt = require("markdown-it");
|
||||
const md = markdownIt({
|
||||
html: true,
|
||||
}).use(require("../helpers/utils").namedHeadingsFilter);
|
||||
const allSettings = settings.ALL_NOTE_SETTINGS;
|
||||
|
||||
module.exports = {
|
||||
eleventyComputed: {
|
||||
settings: (data) => {
|
||||
const currentnote =
|
||||
data.collections.gardenEntry && data.collections.gardenEntry[0];
|
||||
if (currentnote && currentnote.data) {
|
||||
const noteSettings = {};
|
||||
allSettings.forEach((setting) => {
|
||||
let noteSetting = currentnote.data[setting];
|
||||
let globalSetting = process.env[setting];
|
||||
|
||||
let settingValue =
|
||||
noteSetting || (globalSetting === "true" && noteSetting !== false);
|
||||
noteSettings[setting] = settingValue;
|
||||
});
|
||||
return noteSettings;
|
||||
}
|
||||
return {};
|
||||
},
|
||||
noteTitle: (data) => {
|
||||
const currentnote =
|
||||
data.collections.gardenEntry && data.collections.gardenEntry[0];
|
||||
if (currentnote && currentnote.data) {
|
||||
return currentnote.data.title || currentnote.data.page.fileSlug;
|
||||
}
|
||||
return "";
|
||||
},
|
||||
tags: (data) => {
|
||||
const currentnote =
|
||||
data.collections.gardenEntry && data.collections.gardenEntry[0];
|
||||
if (currentnote && currentnote.data) {
|
||||
return currentnote.data.tags;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
content: (data) => {
|
||||
const currentnote =
|
||||
data.collections.gardenEntry && data.collections.gardenEntry[0];
|
||||
if (
|
||||
currentnote &&
|
||||
currentnote.template &&
|
||||
currentnote.template.frontMatter &&
|
||||
currentnote.template.frontMatter.content
|
||||
) {
|
||||
return md.render(currentnote.template.frontMatter.content);
|
||||
}
|
||||
return "";
|
||||
},
|
||||
},
|
||||
};
|
@ -5,6 +5,18 @@ const allSettings = settings.ALL_NOTE_SETTINGS;
|
||||
|
||||
module.exports = {
|
||||
eleventyComputed: {
|
||||
layout: (data) => {
|
||||
if (data.tags.indexOf("gardenEntry") != -1) {
|
||||
return "layouts/index.njk";
|
||||
}
|
||||
return "layouts/note.njk";
|
||||
},
|
||||
permalink: (data) => {
|
||||
if (data.tags.indexOf("gardenEntry") != -1) {
|
||||
return "/";
|
||||
}
|
||||
return data.permalink || undefined;
|
||||
},
|
||||
settings: (data) => {
|
||||
const noteSettings = {};
|
||||
allSettings.forEach((setting) => {
|
||||
|
@ -1,5 +1,4 @@
|
||||
{
|
||||
"layout" : "layouts/note.njk",
|
||||
"tags" : "note",
|
||||
"tags": "note",
|
||||
"templateEngineOverride": "njk,md"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user