Skip to content

Commit

Permalink
Merge pull request #29 from apostrophecms/document-skip-option
Browse files Browse the repository at this point in the history
Document skip option, fix another bug
  • Loading branch information
boutell authored Mar 5, 2024
2 parents 6fb6b75 + ba5cc84 commit ce28a11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"urlType": "Link Type",
"urlTypeInternal": "Internal Page",
"urlTypeExternal": "External URL",
"ignoreQuery": "Ignore query string when matching.",
"forwardQuery": "Forward query string.",
"ignoreQuery": "Ignore query string when matching",
"forwardQuery": "Forward query string",
"newPage": "Page Title",
"external": "URL",
"statusCode": "Redirect Type",
Expand Down
14 changes: 10 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,16 @@ module.exports = {
}

const foundTarget = results.find(({ redirectSlug }) => redirectSlug === slug) ||
results.find(({
redirectSlug,
ignoreQueryString
}) => redirectSlug === pathOnly && ignoreQueryString);
results.find(({
redirectSlug,
ignoreQueryString
}) => redirectSlug === pathOnly && ignoreQueryString);

if (!foundTarget) {
// Query will produce a match if the path matches, but we need
// to implement ignoreQueryString: false properly
return await emitAndRedirectOrNext();
}

const shouldForwardQueryString = foundTarget && foundTarget.forwardQueryString;

Expand Down

0 comments on commit ce28a11

Please sign in to comment.