Skip to content

Commit 2b3282d

Browse files
committed
It generates the pages!!!!
They are all blank but it does at least generate them Signed-off-by: Sam Barker <[email protected]>
1 parent f51dd04 commit 2b3282d

File tree

5 files changed

+100
-0
lines changed

5 files changed

+100
-0
lines changed

Gemfile.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ GEM
2222
eventmachine (>= 0.12.9)
2323
http_parser.rb (~> 0)
2424
eventmachine (1.2.7)
25+
ffi (1.17.2-arm64-darwin)
2526
ffi (1.17.2-x86_64-linux-gnu)
2627
forwardable-extended (2.6.0)
28+
google-protobuf (4.31.1-arm64-darwin)
29+
bigdecimal
30+
rake (>= 13)
2731
google-protobuf (4.31.1-x86_64-linux-gnu)
2832
bigdecimal
2933
rake (>= 13)
@@ -54,6 +58,8 @@ GEM
5458
jekyll (>= 3.0.0)
5559
jekyll-feed (0.17.0)
5660
jekyll (>= 3.7, < 5.0)
61+
jekyll-redirect-from (0.16.0)
62+
jekyll (>= 3.3, < 5.0)
5763
jekyll-sass-converter (3.1.0)
5864
sass-embedded (~> 1.75)
5965
jekyll-seo-tag (2.8.0)
@@ -73,6 +79,8 @@ GEM
7379
rb-fsevent (~> 0.10, >= 0.10.3)
7480
rb-inotify (~> 0.9, >= 0.9.10)
7581
mercenary (0.4.0)
82+
nokogiri (1.18.8-arm64-darwin)
83+
racc (~> 1.4)
7684
nokogiri (1.18.8-x86_64-linux-gnu)
7785
racc (~> 1.4)
7886
pathutil (0.16.2)
@@ -86,6 +94,8 @@ GEM
8694
rexml (3.4.1)
8795
rouge (4.5.2)
8896
safe_yaml (1.0.5)
97+
sass-embedded (1.89.2-arm64-darwin)
98+
google-protobuf (~> 4.31)
8999
sass-embedded (1.89.2-x86_64-linux-gnu)
90100
google-protobuf (~> 4.31)
91101
terminal-table (3.0.2)
@@ -94,13 +104,15 @@ GEM
94104
webrick (1.9.1)
95105

96106
PLATFORMS
107+
arm64-darwin-24
97108
x86_64-linux
98109

99110
DEPENDENCIES
100111
asciidoctor-diagram (~> 2.3.2)
101112
jekyll (~> 4.4.1)
102113
jekyll-asciidoc (~> 3.0.1)
103114
jekyll-feed (~> 0.12)
115+
jekyll-redirect-from
104116
jekyll-sass-converter (~> 3.1.0)
105117
jekyll-seo-tag (~> 2.8.0)
106118
jekyll-toc (~> 0.19.0)

_config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,10 @@ asciidoctor:
8383
toc: preamble
8484
source-highlighter: rouge
8585
sectanchors: ''
86+
87+
defaults:
88+
- scope:
89+
type: pages
90+
path: /redirects
91+
values:
92+
layout: redirect.html

_data/redirects/errors.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
baseUrl: https://kroxylicious.io/documentation/
2+
mappings:
3+
- name: suspectedTls
4+
fromVersion: 0.13.0
5+
path: /html/kroxylicious-proxy/#con-configuring-client-connections-proxy
6+
7+
- name: test
8+
fromVersion: 0.10.0
9+
path: /html/kroxylicious-proxy/#con-configuring-client-connections-proxy
10+
11+

_layouts/redirect.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="refresh" content=00; url={{ target }}>
6+
</head>
7+
<body>
8+
Redirecting to <a href="{{ target }}">{{ target }}</a>...
9+
</body>
10+
</html>

_plugins/redirector.rb

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
module SamplePlugin
2+
class RedirectPageGenerator < Jekyll::Generator
3+
safe true
4+
5+
def generate(site)
6+
config = site.data['redirects']
7+
config.each { |redirectConfig|
8+
Jekyll.logger.info "generating redoirects for #{redirectConfig[0]}"
9+
redirectConfig[1]['mappings'].each do |mapping|
10+
Jekyll.logger.info "generating redoirect for #{redirectConfig[0]}/#{mapping['name']}"
11+
site.pages << RedirectPage.new(site, redirectConfig[0], redirectConfig[1], mapping)
12+
end
13+
Jekyll.logger.info "loaded redirect pages #{redirectConfig[0]}"
14+
}
15+
Jekyll.logger.info "finished generating redirects"
16+
end
17+
end
18+
19+
# Subclass of `Jekyll::Page` with custom method definitions.
20+
class RedirectPage < Jekyll::Page
21+
def initialize(site, group, redirectConfig, mapping)
22+
23+
@site = site # the current site instance.
24+
@base = site.source # path to the source directory.
25+
@dir = "/redirect/#{group}/" # the directory the page will reside in.
26+
27+
# All pages have the same filename, so define attributes straight away.
28+
@basename = mapping['name'] # filename without the extension.
29+
@ext = '.html' # the extension.
30+
@name = basename + ext # basically @basename + @ext.
31+
@layout = 'redirect.html'
32+
33+
@content = "#{redirectConfig['baseUrl']}#{mapping['path']}"
34+
35+
# Initialize data hash with a key pointing to all posts under current category.
36+
# This allows accessing the list in a template via `page.linked_docs`.
37+
@data = {
38+
'version' => mapping['fromVersion'],
39+
'target' => redirectConfig['baseUrl'] + mapping['path'],
40+
}
41+
42+
# # Look up front matter defaults scoped to type `categories`, if given key
43+
# # doesn't exist in the `data` hash.
44+
data.default_proc = proc do |_, key|
45+
site.frontmatter_defaults.find(relative_path, type, key)
46+
end
47+
Jekyll.logger.info "generated redirect page #{@dir}#{@basename}"
48+
end
49+
50+
# Placeholders that are used in constructing page URL.
51+
def url_placeholders
52+
{
53+
:path => @dir,
54+
:category => @dir,
55+
:basename => basename,
56+
:output_ext => output_ext,
57+
}
58+
end
59+
end
60+
end

0 commit comments

Comments
 (0)