jekyll-notion 2.4.0 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- 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 +16 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '088ab1c8e851aa22893826c0ad7c23b54bf6272595b58371b341d9073e3c8808'
|
4
|
+
data.tar.gz: 712a657a2093e556dffdada517ddcb6374254e191e9be84582d4393a69359268
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 776ff09d46941bc596613d3968bd940d5be6d0f2a3d523d3825a055a8ffa92206c87e1a3e44ba7e4f541fae137e62a0f1e786b8a727bba3cc12936511747111c
|
7
|
+
data.tar.gz: 0fe8e951359b66becc5515f4c9f30e3060ba60b8d7e4d328f7af3aeed9484bbd9921dccce105c420509511fee486b6484b05533b56840706c905aaf63811d6ba
|
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.2
|
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-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -36,42 +36,48 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 1.2.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 1.2.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: notion_to_md
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.0'
|
54
|
+
- - "<"
|
52
55
|
- !ruby/object:Gem::Version
|
53
|
-
version: '2.
|
56
|
+
version: '2.4'
|
54
57
|
type: :runtime
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
57
60
|
requirements:
|
58
|
-
- - "
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '2.0'
|
64
|
+
- - "<"
|
59
65
|
- !ruby/object:Gem::Version
|
60
|
-
version: '2.
|
66
|
+
version: '2.4'
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: vcr
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
64
70
|
requirements:
|
65
71
|
- - "~>"
|
66
72
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
73
|
+
version: 6.2.0
|
68
74
|
type: :runtime
|
69
75
|
prerelease: false
|
70
76
|
version_requirements: !ruby/object:Gem::Requirement
|
71
77
|
requirements:
|
72
78
|
- - "~>"
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
80
|
+
version: 6.2.0
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
82
|
name: bundler
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|