Comparing version 0.3.10 to 0.3.11
{ | ||
"name": "notablog", | ||
"version": "0.3.10", | ||
"version": "0.3.11", | ||
"description": "Generate a minimalistic blog from a Notion.so table.", | ||
@@ -5,0 +5,0 @@ "main": "src/index", |
@@ -9,9 +9,9 @@ # notablog | ||
| Mobile | Desktop | | ||
| :--: | :--: | | ||
| ![](assets/v0.3.0_mobile.png) | ![](assets/v0.3.0_desktop.png) | | ||
| Mobile | Desktop | | ||
| :---------------------------: | :----------------------------: | | ||
| ![](assets/v0.3.0_mobile.png) | ![](assets/v0.3.0_desktop.png) | | ||
| Management Interface on Notion.so | | ||
| :----------------------------: | | ||
| ![](assets/v0.3.0_manage.png) | | ||
| :-------------------------------: | | ||
| ![](assets/v0.3.0_manage.png) | | ||
@@ -34,6 +34,8 @@ ### :construction: This is under construction, there may be breaking changes often ! :construction: | ||
> BREAKING CHANGES of `v0.3.0` : If you want to upgrade from `v0.2.1` or lower, please delete old `notablog-starter` and go through [Getting Started](#Getting-Started) again since `notablog-starter` has a lot of changes. | ||
### [2019.09.02] | ||
BREAKING CHANGES of `v0.3.0` : If you want to upgrade from `v0.2.1` or lower, please delete old `notablog-starter` and go through [Getting Started](#Getting-Started) again since `notablog-starter` has a lot of changes. | ||
## Getting Started | ||
@@ -40,0 +42,0 @@ |
@@ -55,2 +55,7 @@ const fs = require('fs') | ||
const tagDir = path.join(workDir, 'public/tag') | ||
if (!fs.existsSync(tagDir)) { | ||
fs.mkdirSync(tagDir, { recursive: true }) | ||
} | ||
/** Copy theme assets. */ | ||
@@ -57,0 +62,0 @@ log.info('Copy theme assets') |
@@ -103,2 +103,3 @@ const { getOnePageAsTree } = require('nast-util-from-notionapi') | ||
*/ | ||
/** | ||
@@ -147,2 +148,3 @@ * @type {PageMetadata[]} | ||
* @property {PageMetadata[]} pages | ||
* @property {Map<string, PageMetadata[]>} tagMap | ||
*/ | ||
@@ -171,5 +173,19 @@ /** | ||
else return 0 | ||
}) | ||
}), | ||
tagMap: new Map() | ||
} | ||
/** | ||
* Create tagMap | ||
*/ | ||
siteMeta.pages.forEach(page => { | ||
page.tags.forEach(tag => { | ||
if (!siteMeta.tagMap.has(tag.value)) { | ||
siteMeta.tagMap.set(tag.value, [page]) | ||
} else { | ||
siteMeta.tagMap.get(tag.value).push(page) | ||
} | ||
}) | ||
}) | ||
return siteMeta | ||
@@ -176,0 +192,0 @@ } |
@@ -37,4 +37,6 @@ const fs = require('fs') | ||
const indexPath = path.join(outDir, 'index.html') | ||
Sqrl.autoEscaping(false) | ||
log.info('Rendering home page') | ||
const html = Sqrl.Render(templateProvider.get('index'), { | ||
@@ -44,2 +46,14 @@ siteMeta | ||
fs.writeFileSync(indexPath, html, { encoding: 'utf-8' }) | ||
siteMeta.tagMap.forEach((pageMetas, tagVal) => { | ||
log.info(`Rendering tag: ${tagVal}`) | ||
const html = Sqrl.Render(templateProvider.get('tag'), { | ||
siteMeta, | ||
tag: { | ||
value: tagVal, | ||
pageMetas | ||
} | ||
}) | ||
fs.writeFileSync(`${outDir}/tag/${tagVal}.html`, html, { encoding: 'utf-8' }) | ||
}) | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
764
203
4603518
16