jekyll-notion 2.4.0 → 2.4.1
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 +7 -1
- data/lib/jekyll-notion/cacheable.rb +2 -10
- data/lib/jekyll-notion/generator.rb +3 -1
- data/lib/jekyll-notion/generators/abstract_generator.rb +4 -0
- data/lib/jekyll-notion/generators/collection_generator.rb +12 -3
- 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: 823cd1e40e6efc0003a0829807361ef7e9aef85d13e7a5a83236be1ea48312b0
|
4
|
+
data.tar.gz: 729882137bd7597ce87f2ba66d8f79df57b794262cd19950b5288f952a8f6c13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a32dc6d722f0692658969df2d7ebfd195e865503c47fda06ed2556f8b7c005968a2c08f96dfe4a5188926fc192094494d53423d107b67ca93a9717952a05f2e4
|
7
|
+
data.tar.gz: 3b8b5b61aa56e48e2823f58c00ddc67af8a9bdc5b892aedd7d13863aea25ecf14cf2def9b64cc1259170974527d00d250b8468b053d38a14e1957037d13f1fd3
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ notion:
|
|
42
42
|
- id: 5cfed4de3bdc4f43ae8ba653a7a2219b
|
43
43
|
```
|
44
44
|
|
45
|
-
By default, the notion pages
|
45
|
+
By default, the notion pages in the database will be loaded into the `posts` collection.
|
46
46
|
|
47
47
|
We can also define __multiple databases__ as follows.
|
48
48
|
|
@@ -80,6 +80,12 @@ notion:
|
|
80
80
|
sorts: [{ "timestamp": "created_time", "direction": "ascending" }]
|
81
81
|
```
|
82
82
|
|
83
|
+
#### Posts date
|
84
|
+
|
85
|
+
The `created_time` property of a notion page is used to set the date in the post filename. This is the date used for the `date` variable of the [predefined variables for posts](https://jekyllrb.com/docs/front-matter/#predefined-variables-for-posts).
|
86
|
+
|
87
|
+
It's important to note that the `created_time` cannot be modifed. However, if you wish to change the date of a post, you can create a new page property named "date" (or "Date"). This way, the posts collection will use the `date` property for the post date variable instead of the `created_time`.
|
88
|
+
|
83
89
|
### Pages
|
84
90
|
|
85
91
|
Individual Notion pages can also be loaded into Jekyll. Just define the `page` property as follows.
|
@@ -26,16 +26,8 @@ module JekyllNotion
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
VCR.use_cassette(
|
31
|
-
end
|
32
|
-
|
33
|
-
def block_children(*args)
|
34
|
-
VCR.use_cassette((args[0][:block_id]).to_s) { super(*args) }
|
35
|
-
end
|
36
|
-
|
37
|
-
def page(*args)
|
38
|
-
VCR.use_cassette((args[0][:page_id]).to_s) { super(*args) }
|
29
|
+
def generate(*args)
|
30
|
+
VCR.use_cassette(resource_id) { super(*args) }
|
39
31
|
end
|
40
32
|
end
|
41
33
|
end
|
@@ -99,7 +99,9 @@ module JekyllNotion
|
|
99
99
|
# Cache Notion API responses
|
100
100
|
if ENV["JEKYLL_ENV"] != "test" && cache?
|
101
101
|
JekyllNotion::Cacheable.setup(config["cache_dir"])
|
102
|
-
|
102
|
+
JekyllNotion::CollectionGenerator.prepend(JekyllNotion::Cacheable)
|
103
|
+
JekyllNotion::PageGenerator.prepend(JekyllNotion::Cacheable)
|
104
|
+
JekyllNotion::DataGenerator.prepend(JekyllNotion::Cacheable)
|
103
105
|
end
|
104
106
|
end
|
105
107
|
|
@@ -40,10 +40,9 @@ module JekyllNotion
|
|
40
40
|
|
41
41
|
def make_filename(page)
|
42
42
|
if @notion_resource.collection_name == "posts"
|
43
|
-
"#{page
|
44
|
-
:mode => "latin")}.md"
|
43
|
+
"#{date_for(page)}-#{Jekyll::Utils.slugify(page.title, :mode => "latin")}.md"
|
45
44
|
else
|
46
|
-
"#{page.title
|
45
|
+
"#{Jekyll::Utils.slugify(page.title, :mode => "latin")}.md"
|
47
46
|
end
|
48
47
|
end
|
49
48
|
|
@@ -61,5 +60,15 @@ module JekyllNotion
|
|
61
60
|
end
|
62
61
|
Jekyll.logger.debug("", "Props => #{collection.docs.last.data.keys.inspect}")
|
63
62
|
end
|
63
|
+
|
64
|
+
def date_for(page)
|
65
|
+
# The "date" property overwrites the Jekyll::Document#data["date"] key
|
66
|
+
# which is the date used by Jekyll to set the post date.
|
67
|
+
DateTime.parse(page.props["date"]).to_date
|
68
|
+
rescue TypeError, NoMethodError
|
69
|
+
# Because the "date" property is not required,
|
70
|
+
# it fallbacks to the created_time which is always present.
|
71
|
+
page.created_time.to_date
|
72
|
+
end
|
64
73
|
end
|
65
74
|
end
|
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: 2.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrique Arias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|