Skip to content

Commit 7607aeb

Browse files
committed
feat: Point feature pages to their correct edit url
Related to #19
1 parent 2be5035 commit 7607aeb

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

antora-playbook.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ asciidoc:
1818
extensions:
1919
- ./extensions/remote-include-processor/extension
2020
- ./extensions/tabs-block/extension
21+
22+
antora:
23+
extensions:
24+
- ./extensions/edit-url/extension

extensions/edit-url/extension.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict'
2+
3+
const CATEGORIES = "categories/pages"
4+
const VERSIONS = "versions/pages"
5+
const INDEX = "index.adoc"
6+
7+
module.exports.register = function () {
8+
this
9+
.on('contentAggregated', ({ contentAggregate }) => {
10+
contentAggregate.forEach(({ name, title, version, nav, files }) => {
11+
files.forEach((file) => {
12+
if (file.src.basename == INDEX) return
13+
if (file.src.path.substring(CATEGORIES) ||
14+
file.src.path.substring(VERSIONS)) {
15+
file.src.editUrl = file.src.origin.webUrl + "/blob/" +
16+
file.src.origin.refname + "/features/" +
17+
file.src.basename
18+
}
19+
})
20+
})
21+
})
22+
}

local-playbook.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ asciidoc:
1818
extensions:
1919
- ./extensions/remote-include-processor/extension
2020
- ./extensions/tabs-block/extension
21+
22+
antora:
23+
extensions:
24+
- ./extensions/edit-url/extension

0 commit comments

Comments
 (0)