5

This will be a fairly easy question I assume but for the life of me, I can't figure out the answer.

What I want:

  • I want to display my Docusaurus documentation pages with a "Edit this page" link on every page.

What I tried:

The problem:

  • pages are displayed fine, but no such "Edit this page" link is displayed!

Relevant information that may help solve the issue:

I have a docusaurus website with the following parameters:

package.json (edited)

{
  ...
  "scripts": {
    "docusaurus": "docusaurus",
    "start": "docusaurus start",
    "build": "docusaurus build",
    "swizzle": "docusaurus swizzle",
    "deploy": "docusaurus deploy",
    "serve": "docusaurus serve --build"
  },
  "dependencies": {
    ...
    "@docusaurus/core": "^2.0.0-beta.14",
    "@docusaurus/plugin-client-redirects": "^2.0.0-beta.14",
    "@docusaurus/preset-classic": "^2.0.0-beta.14",
    "@mdx-js/react": "^1.6.22",
    "clean": "^4.0.2",
    "clsx": "^1.1.1",
    "docusaurus-gtm-plugin": "0.0.2",
    "install": "^0.13.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "redux": "^4.0.5",
    "webpack": "^5.54.0",
    "webpack-cli": "^4.8.0"
  },
  ...
  "devDependencies": {
    "@babel/core": "^7.15.5"
  }
}

docusaurus.config.js

module.exports = {
...
    plugins: [
        [
            require.resolve('docusaurus-gtm-plugin'),
            {
                id: 'TBD1', // GTM Container ID
            }
        ],
    ],
    presets: [
        [
            '@docusaurus/preset-classic',
            {
                docs: {
                    // It is recommended to set document id as docs home page (`docs/` path).
                    //homePageId: 'docIntro',  - deprecated
                    sidebarPath: require.resolve('./sidebars.js'),
                    // Please change this to your repo.
                    editUrl: 'https://gitlab......com/.../-/edit/master/',
                },
                blog: {
                    showReadingTime: true,
                    // Please change this to your repo.
                    editUrl: 'https://gitlab......com/.../-/edit/master/',
                },
                theme: {
                    customCss: require.resolve('./src/css/custom.css'),
                },
                sitemap: {
                    // cacheTime: 600 * 1000, // 600 sec - cache purge period
                    changefreq: 'weekly',
                    priority: 0.5,
                },
            },
        ],
    ]
};

Example screenshot:

Example screenshot

What am I doing wrong?

tik
  • 51
  • 3
  • 1
    We had the same problem as you and fixed it by removing the **custom_edit_url** from our markdown files which was specified at the beginning like so: `--- custom_edit_url: null sidebar_position: 1 ---` See here the documentation why it interferes with your **editUrl** property: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#markdown-front-matter – JohannesDienst Sep 21 '22 at 11:28

0 Answers0