Remove trailing slashes in doc pages URLs to fix links. (#3821)

* Improve broken link detection, remove trailing slashes from URLs.

Closes #3819.

* Preserve hash when removing trailing slash in URL
This commit is contained in:
Antonin Delpeuch 2021-04-24 15:33:24 +02:00 committed by GitHub
parent 791ae1f06b
commit ee72a200e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 3 deletions

View File

@ -6,7 +6,7 @@ sidebar_label: Reconciliation API
_This page is kept for the record. [A cleaner version of this specification](https://reconciliation-api.github.io/specs/0.1/) was written by the [W3C Entity Reconciliation Community Group](https://www.w3.org/community/reconciliation/), which has been formed to improve and promote this API. Join the community group to get involved!_
_This is a technical description of the mechanisms behind the reconciliation system in OpenRefine. For usage instructions, see [Reconciliation](Reconciliation)._
_This is a technical description of the mechanisms behind the reconciliation system in OpenRefine. For usage instructions, see [Reconciliation](/manual/reconciling)._
## Introduction

View File

@ -103,7 +103,7 @@ The `init()` function in `controller.js` allows the extension to register variou
The Extensions are loaded by the Butterfly framework. Butterfly refers to these as 'modules'. [The location of modules is set in the `main/webapp/butterfly.properties` file](https://github.com/OpenRefine/OpenRefine/blob/master/main/webapp/WEB-INF/butterfly.properties#L27). Butterfly simply descends into each of those paths and looks for any `MOD-INF` directories.
For more information, see [Extension Points](Extension-Points).
For more information, see [Extension Points](https://github.com/OpenRefine/OpenRefine/wiki/Extension-Points).
## Extension points
@ -222,7 +222,7 @@ Your command will then be accessible at [http://127.0.0.1:3333/command/my-extens
### Server-side: Operations
Most commands change the project's data. Most of them do so by creating abstract operations. See the Changes, History, Processes, and Operations section of the [Server Side Architecture](Server-side+Architecture) document.
Most commands change the project's data. Most of them do so by creating abstract operations. See the Changes, History, Processes, and Operations section of the [Server Side Architecture](https://github.com/OpenRefine/OpenRefine/wiki/Server-Side-Architecture) document.
You can register an operation **class** in the `init` function as follows:

View File

@ -1,5 +1,6 @@
module.exports = {
onBrokenLinks: 'error',
onBrokenMarkdownLinks: 'error',
title: 'OpenRefine',
tagline: 'A power tool for working with messy data.',
url: 'https://docs.openrefine.org/',
@ -107,4 +108,11 @@ module.exports = {
},
],
],
scripts: [
{
src: '/js/fix-location.js',
async: false,
defer: false,
},
],
};

8
docs/static/js/fix-location.js vendored Normal file
View File

@ -0,0 +1,8 @@
/*
* when trailing slashes are added to URLs, this breaks internal links.
* This is a fix for this issue taken from:
* https://github.com/facebook/docusaurus/issues/2394#issuecomment-630638096
*/
if (window && window.location && window.location.pathname.endsWith('/') && window.location.pathname !== '/') {
window.history.replaceState('', '', window.location.pathname.substr(0, window.location.pathname.length - 1) + window.location.hash)
}