jekyll-fora 1.0.0
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 +7 -0
- data/README.md +82 -0
- data/lib/jekyll-fora.rb +62 -0
- metadata +66 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d03281bcecd25e58c328786acc741da8d8b0d4e6a1fac8f8c1adb2a95f279306
|
|
4
|
+
data.tar.gz: d708390c432152e846e66adfec9a746a851961368a187c1c4e481e9230ce1528
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6d66395e1d96cc93cc235ce60bef9a5bb6ccb9805a9e095aaf1e1bf946d094b428dfd7e30031ed5f4b3282274393c3bda426b65c75566f381e74c72768f9c1a2
|
|
7
|
+
data.tar.gz: 54710939a782ccc1aeff61f371de349463eeaa3fca00351be28cb21ccfa41f6c37e84bcfdc75758c9e8deeb12bdb0b16405b50e9a3793ceed503663782f60189
|
data/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# jekyll-fora
|
|
2
|
+
|
|
3
|
+
Jekyll plugin for embedding [Fora](https://giga.mobile) comments — the fastest embeddable comment system, built on Cloudflare's edge.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
### Via Gemfile
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem "jekyll-fora"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then add to `_config.yml`:
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
plugins:
|
|
17
|
+
- jekyll-fora
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Manual
|
|
21
|
+
|
|
22
|
+
Copy `lib/jekyll-fora.rb` into your project's `_plugins/` directory.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Set your site key in `_config.yml`
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
fora_site_key: "your-site-key"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Add comments to any post or page
|
|
33
|
+
|
|
34
|
+
```liquid
|
|
35
|
+
{% fora_comments %}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Override per-post
|
|
39
|
+
|
|
40
|
+
```liquid
|
|
41
|
+
{% fora_comments site_key="other-site-key" theme="dark" %}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### With theming
|
|
45
|
+
|
|
46
|
+
```liquid
|
|
47
|
+
{% fora_comments accent="#8b5cf6" bg="#0a0a0a" surface="#18181b" text="#e4e4e7" radius="8px" %}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### In a layout
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<article>
|
|
54
|
+
{{ content }}
|
|
55
|
+
</article>
|
|
56
|
+
|
|
57
|
+
{% if page.comments != false %}
|
|
58
|
+
{% fora_comments %}
|
|
59
|
+
{% endif %}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Parameters
|
|
63
|
+
|
|
64
|
+
| Parameter | Config key | Default | Description |
|
|
65
|
+
|-----------|-----------|---------|-------------|
|
|
66
|
+
| `site_key` | `fora_site_key` | — | Your Fora site key |
|
|
67
|
+
| `page_id` | — | page URL | Thread identifier |
|
|
68
|
+
| `page_title` | — | page title | Page title |
|
|
69
|
+
| `theme` | — | `auto` | Theme: `auto`, `light`, `dark` |
|
|
70
|
+
| `container_id` | — | `fora-comments` | DOM container ID |
|
|
71
|
+
| `origin` | — | `https://giga.mobile` | Fora API origin |
|
|
72
|
+
| `features` | — | `""` | Feature flags |
|
|
73
|
+
| `accent` | — | — | Accent color |
|
|
74
|
+
| `bg` | — | — | Background color |
|
|
75
|
+
| `surface` | — | — | Surface color |
|
|
76
|
+
| `text` | — | — | Text color |
|
|
77
|
+
| `font` | — | — | Font family |
|
|
78
|
+
| `radius` | — | — | Border radius |
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|
data/lib/jekyll-fora.rb
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Jekyll-Fora — Fora comments tag for Jekyll
|
|
2
|
+
#
|
|
3
|
+
# Usage in _config.yml:
|
|
4
|
+
# fora_site_key: "your-site-key"
|
|
5
|
+
#
|
|
6
|
+
# Usage in posts/pages:
|
|
7
|
+
# {% fora_comments %}
|
|
8
|
+
# {% fora_comments site_key="your-site-key" theme="dark" %}
|
|
9
|
+
# {% fora_comments site_key="your-site-key" accent="#8b5cf6" radius="8px" %}
|
|
10
|
+
|
|
11
|
+
module Jekyll
|
|
12
|
+
class ForaCommentsTag < Liquid::Tag
|
|
13
|
+
VALID_KEYS = %w[
|
|
14
|
+
site_key page_id page_title theme container_id origin features
|
|
15
|
+
accent bg surface text font radius
|
|
16
|
+
].freeze
|
|
17
|
+
|
|
18
|
+
def initialize(tag_name, markup, tokens)
|
|
19
|
+
super
|
|
20
|
+
@attrs = {}
|
|
21
|
+
markup.scan(/(\w+)\s*=\s*"([^"]*)"/) do |key, value|
|
|
22
|
+
@attrs[key] = value if VALID_KEYS.include?(key)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def render(context)
|
|
27
|
+
site_key = @attrs['site_key'] || context.registers[:site].config['fora_site_key'] || ''
|
|
28
|
+
page_id = @attrs['page_id'] || context['page']['url'] || context['page']['path'] || ''
|
|
29
|
+
page_title = @attrs['page_title'] || context['page']['title'] || ''
|
|
30
|
+
theme = @attrs['theme'] || 'auto'
|
|
31
|
+
container_id = @attrs['container_id'] || 'fora-comments'
|
|
32
|
+
origin = @attrs['origin'] || 'https://giga.mobile'
|
|
33
|
+
features = @attrs['features'] || ''
|
|
34
|
+
|
|
35
|
+
attrs = %(data-site-key="#{escape(site_key)}")
|
|
36
|
+
attrs += %( data-page-id="#{escape(page_id)}") unless page_id.empty?
|
|
37
|
+
attrs += %( data-page-title="#{escape(page_title)}") unless page_title.empty?
|
|
38
|
+
attrs += %( data-theme="#{escape(theme)}")
|
|
39
|
+
attrs += %( data-container-id="#{escape(container_id)}")
|
|
40
|
+
attrs += %( data-features="#{escape(features)}") unless features.empty?
|
|
41
|
+
|
|
42
|
+
# Theming overrides
|
|
43
|
+
%w[accent bg surface text font radius].each do |key|
|
|
44
|
+
val = @attrs[key]
|
|
45
|
+
attrs += %( data-#{key}="#{escape(val)}") if val && !val.empty?
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
<<~HTML
|
|
49
|
+
<div id="#{escape(container_id)}"></div>
|
|
50
|
+
<script src="#{escape(origin)}/embed.js" #{attrs}></script>
|
|
51
|
+
HTML
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def escape(str)
|
|
57
|
+
CGI.escapeHTML(str.to_s)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
Liquid::Template.register_tag('fora_comments', Jekyll::ForaCommentsTag)
|
metadata
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jekyll-fora
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Giga Mobile
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-03-25 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: jekyll
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '3.0'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '5.0'
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '3.0'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '5.0'
|
|
33
|
+
description: A Jekyll plugin that adds a {% fora_comments %} Liquid tag for embedding
|
|
34
|
+
Fora comment widgets on any Jekyll site.
|
|
35
|
+
email:
|
|
36
|
+
- hello@giga.mobile
|
|
37
|
+
executables: []
|
|
38
|
+
extensions: []
|
|
39
|
+
extra_rdoc_files: []
|
|
40
|
+
files:
|
|
41
|
+
- README.md
|
|
42
|
+
- lib/jekyll-fora.rb
|
|
43
|
+
homepage: https://giga.mobile
|
|
44
|
+
licenses:
|
|
45
|
+
- MIT
|
|
46
|
+
metadata: {}
|
|
47
|
+
post_install_message:
|
|
48
|
+
rdoc_options: []
|
|
49
|
+
require_paths:
|
|
50
|
+
- lib
|
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
|
+
requirements:
|
|
53
|
+
- - ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: '0'
|
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
requirements: []
|
|
62
|
+
rubygems_version: 3.0.3.1
|
|
63
|
+
signing_key:
|
|
64
|
+
specification_version: 4
|
|
65
|
+
summary: Fora comments for Jekyll — the fastest embeddable comment system
|
|
66
|
+
test_files: []
|