jekyll-notion 0.1.2 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad5bd5565352088d6d5d4048155a6abfb38bb0136437159ed7fdfd7d0aaf27a1
4
- data.tar.gz: 57d4da4ceec1869150d33c9bdc10825a636de18409798725bf1ae891d1459b50
3
+ metadata.gz: db8a62e0d2b12f5cedd1f405e289e95a974a22a80e8c4ffd9e0798a75806773a
4
+ data.tar.gz: 4668f71e64ff3604223b664a251b22931ce23d889c535b06e39f735891252074
5
5
  SHA512:
6
- metadata.gz: 5749b831d1884f5d88b344d92ff924dc474813098b05dedfc0862a38dceada9ac8e31c9fd5a80ff418a3974d8ff61fd8879a2c7522dfb1bff2c02b133e82d83f
7
- data.tar.gz: c10de414ceb372b5e2c2a29ba06878f69aaa6f01cc7d37b0a1a8f50078a55b92d4d63a2709e963f2da625ac73878008ae33a0c74c375ecf06f67b5b08c02a0cc
6
+ metadata.gz: ae19056b6cd4692b327d37803bf2c4a7afda07f6736cf2af660c12908694249a34c5e813191843d6ee2aa230f211a4044fbdca1fb203a827f6629aa3707e9e5c
7
+ data.tar.gz: a7dd6dea825e2124032ec6900638a913fcc4e05de009798e24b365aa19c41f80fd399316bc6b9f811ea4c8a96e659d9cab11371dff60650752a7bd3aff847df8
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
- The other properties are:
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
- read_notion_database
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.downcase.parameterize}.md"
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
@@ -66,13 +76,17 @@ module JekyllNotion
66
76
  end
67
77
 
68
78
  def collection
69
- @collection ||= @site.collections[collection_name]
79
+ @site.collections[collection_name]
70
80
  end
71
81
 
72
82
  def config
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.")
@@ -43,7 +43,7 @@ module JekyllNotion
43
43
  end
44
44
 
45
45
  def query
46
- { :id => id, :filter => filter, :sort => sort }
46
+ { :id => id, :filter => filter, :sort => sort }.compact
47
47
  end
48
48
  end
49
49
  end
@@ -113,6 +113,10 @@ module JekyllNotion
113
113
  def date(prop)
114
114
  prop.date.start
115
115
  end
116
+
117
+ def url(prop)
118
+ prop.url
119
+ end
116
120
  end
117
121
  end
118
122
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllNotion
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.6"
5
5
  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: 0.1.2
4
+ version: 0.1.6
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-01-26 00:00:00.000000000 Z
11
+ date: 2022-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport