jekyll-notion 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/jekyll-notion/generator.rb +16 -2
- data/lib/jekyll-notion/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b38cf8b23326c2c3194070cf8524128f90b479a7f98f7380eaa0f43d1beaa211
|
|
4
|
+
data.tar.gz: 359ffd254d24ad6fbc1d3fc5ca4ab389a098fae102577f2ed2ecb9f4b6ee1cb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c2b17935b8c5512650a1eb5bfa2dddfca7aad405ca3482ec2ae8a5cb2b4157b70df1be10956075c275d4ab839c1c3156366e85c533c64e34c206167204878de
|
|
7
|
+
data.tar.gz: 2047c8d35e0713edc09253fb44ecd20bc364a6daa4a21620f9431951b5a41ac7c55c2171441364c3b21e474d1340bef2129612b2069b571930f9797c35d10c06
|
data/README.md
CHANGED
|
@@ -36,6 +36,7 @@ Once your notion database has been shared, specify the `id` in your `_config.yml
|
|
|
36
36
|
|
|
37
37
|
```yml
|
|
38
38
|
notion:
|
|
39
|
+
fetch_on_watch: false
|
|
39
40
|
database:
|
|
40
41
|
id: b91d5...
|
|
41
42
|
collection: posts
|
|
@@ -45,13 +46,16 @@ notion:
|
|
|
45
46
|
layout: post
|
|
46
47
|
```
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
`fetch_on_watch` when set to `true` it allows fetching notion pages on each rebuild. By default is off, pages are only retrieved in the first build.
|
|
50
|
+
|
|
51
|
+
`database` properties are:
|
|
52
|
+
* `id`: the notion database unique identifier,
|
|
49
53
|
* `collection`: the collection each page belongs to (posts by default),
|
|
50
54
|
* `filter`: the database query filter,
|
|
51
55
|
* `sort`: the database query sort,
|
|
52
56
|
* `frontmatter`: additional frontmatter to append to each page in the collection.
|
|
53
57
|
|
|
54
|
-
Note: Only one database is available.
|
|
58
|
+
Note: Only one notion database is available.
|
|
55
59
|
|
|
56
60
|
And that's all. Each page in the notion database will be included in the selected collection.
|
|
57
61
|
|
|
@@ -9,7 +9,11 @@ module JekyllNotion
|
|
|
9
9
|
|
|
10
10
|
return unless notion_token? && config?
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
if fetch_on_watch? || docs.empty?
|
|
13
|
+
read_notion_database
|
|
14
|
+
else
|
|
15
|
+
collection.docs = docs
|
|
16
|
+
end
|
|
13
17
|
end
|
|
14
18
|
|
|
15
19
|
def read_notion_database
|
|
@@ -19,6 +23,11 @@ module JekyllNotion
|
|
|
19
23
|
collection.docs << make_page
|
|
20
24
|
Jekyll.logger.info("Jekyll Notion:", "New notion page at #{collection.docs.last.path}")
|
|
21
25
|
end
|
|
26
|
+
@docs = collection.docs
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def docs
|
|
30
|
+
@docs ||= []
|
|
22
31
|
end
|
|
23
32
|
|
|
24
33
|
def make_page
|
|
@@ -55,7 +64,8 @@ module JekyllNotion
|
|
|
55
64
|
|
|
56
65
|
def make_filename
|
|
57
66
|
if collection_name == "posts"
|
|
58
|
-
"#{current_page.created_date}-#{current_page.title
|
|
67
|
+
"#{current_page.created_date}-#{Jekyll::Utils.slugify(current_page.title,
|
|
68
|
+
:mode => "latin")}.md"
|
|
59
69
|
else
|
|
60
70
|
"#{current_page.title.downcase.parameterize}.md"
|
|
61
71
|
end
|
|
@@ -73,6 +83,10 @@ module JekyllNotion
|
|
|
73
83
|
@config ||= @site.config["notion"] || {}
|
|
74
84
|
end
|
|
75
85
|
|
|
86
|
+
def fetch_on_watch?
|
|
87
|
+
config["fetch_on_watch"].present?
|
|
88
|
+
end
|
|
89
|
+
|
|
76
90
|
def notion_token?
|
|
77
91
|
if ENV["NOTION_TOKEN"].nil? || ENV["NOTION_TOKEN"].empty?
|
|
78
92
|
Jekyll.logger.warn("Jekyll Notion:", "NOTION_TOKEN not provided. Cannot read from Notion.")
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-notion
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Enrique Arias
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|