Comments (7)
One final update: since ~~
was reserved for a totally different reason (it gets stripped if filename optimization is turned on), the final default prefix is ^
, but it can also be changed by using a NetlifyRedirectPrefix
setting.
With that, this is ready to ship in the next release once I clean up some Statiq Framework stuff I added to support it, add some more tests, and write documentation.
from statiq.web.
I feel netlify is at fault here and Statiq can not be expected to provide a solution.
I feel we could, however provide an easy workaround.
What if we created a module that would automatically redirect a whole folder based on a setting?
Say the user creates a folder named dotWellKnown/
and supplies the setting to redirect from .well-known/
to dotWellKnown/
.
Statiq would then go its normal way of outputting the documents to the dotWellKnown/
folder, create redirect documents in the .well-known/
folder and, since we are on netlify also write the redirects into the _redirects
file.
Now, when the deployment to netlify occurs, the documents in .well-known/
will not be deployed. This won't be a problem though, because the _redirects
file will be deployed.
from statiq.web.
Small change of plans - the prefix for designating these is now a double tilde ~~
instead of underscores since underscore files are already ignored by Statiq by default and revising that would be a whole thing.
So as a revised example, for a .well-known folder
, you'd name that ~~.well-known
in your input folder, set NetlifyRedirects
to true
, and you're done.
from statiq.web.
I feel netlify is at fault here and Statiq can not be expected to provide a solution.
I generally agree, but the pragmatic side of me also feels like if there's something we can do, might as well do what we can.
The more I thought about this, the more I think automating essentially what you described might work. I.e. if a particular flag is set (something like NetlifyDotFolderRedirects
, which we can set automatically when Netlify deployment is turned on, or user can set manually if deploying to Netlify externally) then we'll find dot folders, rename them, and add the correct _redirects
entries.
Now the complication is that it looks like we're also skipping _redirects
files, so I need to look into that first. Have a tiny bit of time so might end up hacking this whole feature together today if it's not too tough.
from statiq.web.
Now the complication is that it looks like we're also skipping _redirects files [...]
I think we're only skipping them when they are not automatically created. If "we" create them they do have a nice contentType associated and will be added to the output.
However, I feel that logic currently misses some way to define static redirects to be added. (Or rather add or modify the list of redirects)
from statiq.web.
I think we're only skipping them when they are not automatically created. If "we" create them they do have a nice contentType associated and will be added to the output.
Yep - went down a rabbit hole on this a bit this afternoon in preparation for making it work with dot files/folders. I wanted an existing _redirects
file to carry over to output when NetlifyRedirects
is true
(which seemed like a reasonable signal for making sure a _redirects
file makes it to output since it's a Netlify file convention). It now also makes sure that any redirects we generate are combined with an existing redirects file rather than overwriting it.
Now that that's done, I'll likely tackle the dot file/folders thing tomorrow.
from statiq.web.
Ended up not quite making this automatic. It was too hard to perform renaming of documents from other pipelines, so instead it works by generating content in the _redirects
file for any file or folder that starts with a double underscore __
. This behavior is automatically turned on when NetlifyRedirects
is true
(but can be turned off by setting NetlifyUnderscoreRedirects
to false
). A side benefit is that it'll work for any file or folder with a double underscore prefix just in case there are other situations like this where you can't upload or serve the asset in Netlify directly.
So as an example, for a .well-known
folder, you'd name that __.well-known
in your input folder, set NetlifyRedirects
to true
, and you're done.
from statiq.web.
Related Issues (20)
- Release 1.0.0-beta.50 is broken with Search Index Generation enabled HOT 3
- Post is published even if the published date is only tomorrow HOT 5
- Statiq.Web.props to Statiq.Web.targets causing compilation issues HOT 2
- How to set FrontMatterRegexes to use custom Frontmatter? HOT 3
- Sitemap is missing lastmod values HOT 4
- LESS: 'background: center/xx' breaks the compilation HOT 4
- Strict run and add document metadata in runtime HOT 1
- RSS missing feed title HOT 4
- Question: Include example HOT 2
- Microsoft.Azure.Search is Deprecated, and has known vulnerabilities
- install pptx HOT 2
- [Bug] Images don't show on post listing HOT 2
- SCSS regeneration is not working when changing imported files HOT 4
- Stack overflow. Repeat 611 times: Netlify deploy HOT 3
- Example in Guide -> Deployment -> GitHub Pages does not work with GitHub Actions HOT 2
- Add minification modules as options
- Analyzer warning when using Unicode Tags. HOT 2
- Link validation appears to be flagging mailto links HOT 4
- Hot reload stops working after a compiler error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statiq.web.