mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
FEAT Add linkfield docs (#286)
This commit is contained in:
parent
8ce02bcf8e
commit
13dcc5d442
@ -48,7 +48,7 @@ exports.onCreateNode = async ({ node, getNode, getNodesByType, actions, createNo
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const basePath = category === 'user' ? `docs/en/userguide` : `en`;
|
const basePath = category === 'user' ? 'docs/en/userguide' : (thirdparty ? 'docs/en' : 'en');
|
||||||
const filePath = createFilePath({
|
const filePath = createFilePath({
|
||||||
node,
|
node,
|
||||||
getNode,
|
getNode,
|
||||||
|
@ -8,6 +8,15 @@ module.exports = [
|
|||||||
patterns: 'en/**'
|
patterns: 'en/**'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
resolve: 'gatsby-source-git',
|
||||||
|
options: {
|
||||||
|
name: 'docs--5--optional_features/linkfield',
|
||||||
|
remote: 'https://github.com/silverstripe/silverstripe-linkfield.git',
|
||||||
|
branch: '4.0',
|
||||||
|
patterns: 'docs/en/**'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
resolve: 'gatsby-source-git',
|
resolve: 'gatsby-source-git',
|
||||||
options: {
|
options: {
|
||||||
|
@ -96,7 +96,33 @@ const rewriteLink = (
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// absolute links
|
// absolute links to docs (unversioned)
|
||||||
|
if (href.match(/^https?:\/\/docs.silverstripe.org\/en\/[a-zA-Z]/)) {
|
||||||
|
return createElement(
|
||||||
|
Link,
|
||||||
|
{
|
||||||
|
to: path.join('/', 'en', version, href.replace(/^https?:\/\/docs.silverstripe.org\/en/, '')),
|
||||||
|
className: 'gatsby-link'
|
||||||
|
},
|
||||||
|
domToReact(children, parseOptions)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// absolute links to docs (versioned)
|
||||||
|
const hrefMatch = href.match(/^https?:\/\/docs.silverstripe.org\/en\/([0-9]+)/);
|
||||||
|
if (hrefMatch) {
|
||||||
|
const hrefVersion = hrefMatch[1];
|
||||||
|
return createElement(
|
||||||
|
Link,
|
||||||
|
{
|
||||||
|
to: path.join('/', 'en', hrefVersion, href.replace(/^https?:\/\/docs.silverstripe.org\/en\/([0-9]+)/, '')),
|
||||||
|
className: 'gatsby-link'
|
||||||
|
},
|
||||||
|
domToReact(children, parseOptions)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// absolute links to anywhere else
|
||||||
if (href.match(/^https?/)) {
|
if (href.match(/^https?/)) {
|
||||||
return createElement(
|
return createElement(
|
||||||
'a',
|
'a',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user