Skip to content

Commit

Permalink
fix regexp $
Browse files Browse the repository at this point in the history
  • Loading branch information
zbycz committed Dec 19, 2024
1 parent 4b6669b commit c78d6d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/helpers/LangLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ export const getUrlForLangLinks = (ctx: DocumentContext) => {
// Related issue - even though it is closed: https://github.com/vercel/next.js/issues/36275

const fixedPath = ctx.asPath
.replace(/^\/[a-z]{2}(\/|^)/, '$1')
.replace(/^\/[a-z]{2}(\/|$)/, '$1')
.replace(/\?nxtPall=.*$/, '');
console.log('fixedPath', fixedPath);
console.log('fixedPath2', fixedPath);
if (fixedPath === '/') {
return '';
}

const matches = fixedPath.match(/^\/(?:node|way|relation)\/\d+$/);
console.log('matches', matches);
console.log('matches2', matches);
return matches ? `${matches[0]}` : false;
};

Expand Down

0 comments on commit c78d6d1

Please sign in to comment.