Issue with Redirects and Jekyll

To be clear, this may not be an issue. This may not be a CLI issue. This may just be me being dense. :wink:

When first testing netlify dev, I noticed I had not set up redirects correctly for my site. I began testing and noticed that my changes were not being reflected unless I completely restarted the CLI.

I read the docs on telling Jekyll to include underscore files and adding this to my config:

include: [_redirects]

This worked in that my generated _site directory got the copy, but didn’t address the problem while running netlify dev. I noticed that changes to /_redirects did not copy to _site/_redirects until after I told Jekyll to generate a new build.

My site takes near ten minutes to build so for now I’m simply copying the file by hand while it runs, but I just wanted to share this in case it is a real bug, or I’m missing something obvious.

Hiya, as per our docs on netlify dev, your _redirects file needs to live in the projects publish folder.

Does this help?

FYI, I replied earlier but the site never “saved” the response. :frowning:

No… well maybe and I don’t get it. :wink: So I added _redirects to my site route. I told Jekyll to include it. If I run a jekyll build , it copies it.

But when using netlify dev , changes to the file do NOT get noticed and copied.

Does that make sense?

cc @perry i think our docs may be slightly misleading on this. netlify dev does not copy the _redirects file for you, because thats something your build tool does and we run your devserver, not your build tool, during netlify dev. so we actually have to point people to the static folder in the [dev] block in netlify.toml where _redirects is contained.

1 Like

I tried to find the document that describes how to point netlify.toml to my static _redirects file and I couldn’t find it. Help? Thanks.

hi jbrains, you cant find it because it is dreadfully named and poorly designed. this is our fault. we will fix this eventually.

# sample dev block in the toml
# note: each of these fields are OPTIONAL and should only be used if you need an override
[dev]
  publish = "dist" # If you use a _redirect file, provide the path to your static content folder