mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-02 02:42:41 +02:00
feat(v2): editUrl function for advanced use-cases (#4121)
* EditUrl function * normalize blog/docs regarding the editUrl feature + editUrl function * editUrl fn => always inject posix style relative paths, make tests more reliable (see also https://github.com/facebook/docusaurus/issues/4124) * fix editUrl on windows
This commit is contained in:
parent
15c50e2ecb
commit
be7b5dca78
15 changed files with 368 additions and 69 deletions
|
@ -41,6 +41,7 @@ const isBootstrapPreset = process.env.DOCUSAURUS_PRESET === 'bootstrap';
|
|||
|
||||
const isVersioningDisabled = !!process.env.DISABLE_VERSIONING;
|
||||
|
||||
/** @type {import('@docusaurus/types').DocusaurusConfig} */
|
||||
module.exports = {
|
||||
title: 'Docusaurus',
|
||||
tagline: 'Build optimized websites quickly, focus on your content',
|
||||
|
@ -76,7 +77,12 @@ module.exports = {
|
|||
{
|
||||
id: 'community',
|
||||
path: 'community',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: ({locale, versionDocsDirPath, docPath}) => {
|
||||
if (locale !== 'en') {
|
||||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${versionDocsDirPath}/${docPath}`;
|
||||
},
|
||||
editCurrentVersion: true,
|
||||
routeBasePath: 'community',
|
||||
sidebarPath: require.resolve('./sidebarsCommunity.js'),
|
||||
|
@ -204,8 +210,12 @@ module.exports = {
|
|||
// routeBasePath: '/',
|
||||
path: 'docs',
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: ({locale, versionDocsDirPath, docPath}) => {
|
||||
if (locale !== 'en') {
|
||||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${versionDocsDirPath}/${docPath}`;
|
||||
},
|
||||
editCurrentVersion: true,
|
||||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
|
@ -227,8 +237,12 @@ module.exports = {
|
|||
blog: {
|
||||
// routeBasePath: '/',
|
||||
path: '../website-1.x/blog',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website-1.x/',
|
||||
editUrl: ({locale, blogDirPath, blogPath}) => {
|
||||
if (locale !== 'en') {
|
||||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`;
|
||||
},
|
||||
postsPerPage: 3,
|
||||
feedOptions: {
|
||||
type: 'all',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue