Module: Jekyll::SubscriberOnly
- Extended by:
- SubscriberOnly
- Included in:
- SubscriberOnly
- Defined in:
- lib/jekyll/subscriber_only.rb,
lib/jekyll/subscriber_only/version.rb,
lib/jekyll/subscriber_only/jekyll_feed_patch.rb
Defined Under Namespace
Modules: JekyllFeedPatch
Classes: Conf
Constant Summary
collapse
- VERSION =
"1.0.0"
Instance Method Summary
collapse
Instance Method Details
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/jekyll/subscriber_only.rb', line 23
def configure(site)
jekyll_conf = site.config["subscriber_only"]
base_url = "https://app.subscriber-only.com"
if jekyll_conf.nil?
die("The site must be configured before you're able to make your " \
"posts subscriber-only. Go to #{new_site_url} to configure the " \
"site.")
end
env = jekyll_conf["env"]
base_url = "http://localhost:3000" if env == "development"
@conf = Conf.new(
env: env,
public_token: jekyll_conf["public_token"],
secret_token: jekyll_conf["secret_token"],
base_url: base_url,
script_url: "#{base_url}/so.js",
upload_url: URI("#{base_url}/api/v1/posts"),
)
return unless @conf.public_token.nil? || @conf.secret_token.nil?
die("Public and secret tokens must be configured to enable subscriber-" \
"only posts. Go to #{edit_site_url} to get the tokens.")
end
|
#paywall(doc) ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/jekyll/subscriber_only.rb', line 51
def paywall(doc)
return unless subscriber_only?(doc)
info("Paywalling post \"#{doc['title']}\"")
upload_post(doc)
replace_content(doc)
end
|