The following options are also supported and will be passed directly to the send module:. You're able to alter this options when calling reply. If set to true , fastify-static redirects to the directory with a trailing slash. This option cannot be set to true with wildcard set to false on a server with ignoreTrailingSlash set to true. If this option is set to false , then requesting directories without trailing slash will trigger your app's handler using reply.
If set to true , fastify-static adds a wildcard route to serve files. This option cannot be set to false with redirect set to true on a server with ignoreTrailingSlash set to true.
This function allows filtering the served files. If the function returns true , the file will be served. If the function returns false , Fastify's handler will be called. Under the hood we use send lib that by default supports "index. To disable this set false or to supply a new index pass a string or an array in preferred order. Directory list can be also in html format; in that case, list.
You can override the option with URL parameter format. Options are html and json. Directory list can respond to different routes, declared in list. If true some extended information for folders will be accessible in list. Warning: This will slightly decrease the performance, especially for deeply nested file structures.
Try to send the brotli encoded asset first when supported within the Accept-Encoding headers , retry for gzip, then the fall back to the original pathname. You may choose to skip compression for smaller files that don't benefit from it. The target attribute specifies where the linked document will open when the link is clicked. The default is the current window. This allows a user to click on a reference and come back to it later without leaving the current page. It keeps visitors on your site longer and improves most of your metrics: bounce rate, conversion, pages visited.
You can see a slightly modified form of this code in action on every page of this website. This trick requires jQuery , but there is a good chance you are using it already. It is used in the most popular frameworks and content management systems, including WordPress , Drupal , and Twitter Bootstrap.
It is recommended performance benefits to use:. If not found, it will open up a new window with that name. Using one of the reserved target names will bypass the "looking" phase. I haven't tried it on several browsers, but should only open up one window.
The target attribute of a link forces the browser to open the destination page in a new browser window. Just my five cents. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 10 years, 9 months ago. Active 1 year, 3 months ago. Viewed k times. Improve this question. Alex Grin Alex Grin 7, 6 6 gold badges 30 30 silver badges 55 55 bronze badges. Vicario I was referring to "You could write But thinking about it, I'd argue that "has no special meaning" is not the same as "is explicitly discouraged", but that might be me nitpicking ; — fresskoma.
Add a comment. Active Oldest Votes. Improve this answer. Community Bot 1 1 1 silver badge.
0コメント