Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make excludes more intuitive #140

Open
generalpiston opened this issue Feb 23, 2021 · 3 comments
Open

Make excludes more intuitive #140

generalpiston opened this issue Feb 23, 2021 · 3 comments

Comments

@generalpiston
Copy link
Contributor

The exclude option is incredibly unintuitive. The examples look like the following:

exclude: [
  `/dev-404-page`,
  `/404`,
  `/404.html`,
  `/offline-plugin-app-shell-fallback`,
  `/my-excluded-page`,
  /(\/)?hash-\S*/, // you can also pass valid RegExp to exclude internal tags for example
],

The above examples make it seem like /dev-404-page would either match a URI exactly or the beginning of it (ie. /dev-404-page would be rejected or /dev-404-page/.* would be rejected).

In reality, the following examples would be rejected:

  • /dev-404-page
  • /aaa/dev-404-page/loremipsum
  • /dev-404-pageandsomeotherstuff

That is really unintuitive.

Can it be an exact match? Or a start of URI match? Otherwise, can we add notes in the README?

@AleC77
Copy link

AleC77 commented Mar 18, 2021

any update about that? I am interested to this me too. For international web sites I would make something like /es/*

@mrseanbaines
Copy link

Super confusing. If you pass a regex, it looks like they strip the leading slash before matching against the regex 🤯

@mrseanbaines
Copy link

@AleC77 I am also working with a localized site and I think I have it working. I'm using regexes and omitting the leading slash (due to the above quirk). So something like:

exclude: [
    /^..\/some-path\/?$/, // exact path, with or without trailing slash (e.g. "/en/some-path" or "/en/some-path/")
    /^..\/some-path.*/, // any path that starts with this (e.g. "/en/some-path" or "/en/some-path-here")
],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants