-
-
Notifications
You must be signed in to change notification settings - Fork 657
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
added documentation regarding the static middleware #4518 #4736
added documentation regarding the static middleware #4518 #4736
Conversation
Added documentation of static middleware
✅ Deploy Preview for volto ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This looks good.
My suggestions and questions pertain only to English and MyST grammar, formatting, syntax, and style.
A core contributor should also review the content for accuracy.
docs/source/recipes/express.md
Outdated
@@ -42,6 +42,41 @@ if (__SERVER__) { | |||
} | |||
``` | |||
|
|||
## Static Middleware | |||
|
|||
The `staticMiddleware` is for serving static files (such as stylesheets and client-side JavaScript files) in the `BUILD_DIR/PUBLIC` or `PUBLIC_DIR` directory. It uses the `express.static()` function to serve static files and the `setHeaders()` function to add response headers to the files that it serves. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One sentence per line.
The `staticMiddleware` is for serving static files (such as stylesheets and client-side JavaScript files) in the `BUILD_DIR/PUBLIC` or `PUBLIC_DIR` directory. It uses the `express.static()` function to serve static files and the `setHeaders()` function to add response headers to the files that it serves. | |
The `staticMiddleware` is for serving static files such as style sheets and client-side JavaScript files from the `BUILD_DIR/PUBLIC` or `PUBLIC_DIR` directory. | |
It uses the `express.static()` function to serve static files, and the `setHeaders()` function to add response headers to the files that it serves. |
For staticMiddleware
, is that a setting? Perhaps it should be the following?
To add new middleware, use the `settings. staticMiddleware ` configuration key.
[What are valid values for this key?]
Also a code example would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { settings as defaultSettings } from '@plone/volto/config';
import express from 'express';
const settings = { ...defaultSettings };
if (__SERVER__) {
const customStaticMiddleware = express.static('test/static/files');
function setCustomHeaders(req, res, next) {
res.setHeader('Cache-Control', 'public, max-age=3600');
next();
}
customStaticMiddleware.setHeaders = setCustomHeaders;
customStaticMiddleware.id = 'custom-static-middleware';
settings.expressMiddleware = [
...defaultSettings.expressMiddleware,
customStaticMiddleware,
];
}
I am not sure if this is correct. Please confirm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sneridagh @nileshgulia1 @ksuess or any other qualified person could we get a review of this Express middleware code example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, maybe we can add this piece of code to the docs too.
docs/source/recipes/express.md
Outdated
```js | ||
|
||
settings.staticFiles = [ | ||
...,{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code example should be run through whatever JavaScript linter Volto uses. I think this example would be reformatted.
made syntax and formatting changes for static middleware documentation
Co-authored-by: Steve Piercy <web@stevepiercy.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes. I approve the English and MyST syntax and style fixes.
We need a maintainer or other qualified person to review the code example and the rest of the content for accuracy, and then we can merge it.
Oops, this PR needs a towncrier entry. See https://6.docs.plone.org/contributing/index.html#change-log-entry |
Co-authored-by: Steve Piercy <web@stevepiercy.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, let's add the code sample to the docs as well and it's mergeable.
Added static middleware docs code part plone#4518
…m/BhardwajAditya-github/volto into Static-middleware-docs-plone#4518
* master: (83 commits) Apply suggestion from browser for password field (#4524) (fix):Object.normaliseMail: Cannot read properties of null (#4558) Fix link in Volto, remove from linkcheck ignore in Documentation v6.0 (#4742) added documentation regarding the static middleware #4518 (#4736) Closes issue #4567 (#4570) Fix whitespace in locales created by the generator (#4737) Tidy up from synch with 16.x.x (#4728) Release notes from 16.20.2, 16.20.3, 16.20.4 (#4729) Use new URL 6.docs.plone.org (#4726) Security upgrade for momentjs (#4715) Don't decode querystring while adding apiExpanders (#4719) (Synchronize redundant block id in listing block on pasting) Fix duplicating listing block (#4239) Translate add-on control panel (cleaned up PR) (#4620) Fix Move to top of folder ordering in folder content view by searchin… (#4709) Fix robot.txt - the sitemap link should respect x-forwarded headers (#4704) Refactor faulty reorder elements in ObjectBrowserList widget (#4703) Release changelog notes for 16.20.1 Release 17.0.0-alpha.5 Generate a split sitemap (also fix robots.txt) (#4639) Fix search block in edit mode re-queries multiple blocks with an empty search text (#4694) ...
* master: (185 commits) fix: unresponsive add page (#4507) Apply suggestion from browser for password field (#4524) (fix):Object.normaliseMail: Cannot read properties of null (#4558) Fix link in Volto, remove from linkcheck ignore in Documentation v6.0 (#4742) added documentation regarding the static middleware #4518 (#4736) Closes issue #4567 (#4570) Fix whitespace in locales created by the generator (#4737) Tidy up from synch with 16.x.x (#4728) Release notes from 16.20.2, 16.20.3, 16.20.4 (#4729) Use new URL 6.docs.plone.org (#4726) Security upgrade for momentjs (#4715) Don't decode querystring while adding apiExpanders (#4719) (Synchronize redundant block id in listing block on pasting) Fix duplicating listing block (#4239) Translate add-on control panel (cleaned up PR) (#4620) Fix Move to top of folder ordering in folder content view by searchin… (#4709) Fix robot.txt - the sitemap link should respect x-forwarded headers (#4704) Refactor faulty reorder elements in ObjectBrowserList widget (#4703) Release changelog notes for 16.20.1 Release 17.0.0-alpha.5 Generate a split sitemap (also fix robots.txt) (#4639) ...
* master: (29 commits) Remove max_line_length from .editorconfig (plone#4776) Fix bug showing logs at the browsers when richtext widget is use (plone#4780) Show expired and future content in contents view (plone#4764) Fix reducing expanders loaded in a subrequest (plone#4761) Update release notes for 16.20.5 and 16.20.6 (plone#4759) Release 17.0.0-alpha.7 Try to sort out volto's use of language codes (plone#4741) Improve .npmignore to not include not needed files/folders (plone#4746) Release 17.0.0-alpha.6 Control panel list SSR (plone#3749) Open all accordion'd content in InlineForm by default, allow arbitrarily close any number of them (plone#4178) Upgrade to Plone 6.0.4 (plone#4743) fix: unresponsive add page (plone#4507) Apply suggestion from browser for password field (plone#4524) (fix):Object.normaliseMail: Cannot read properties of null (plone#4558) Fix link in Volto, remove from linkcheck ignore in Documentation v6.0 (plone#4742) added documentation regarding the static middleware plone#4518 (plone#4736) Closes issue plone#4567 (plone#4570) Fix whitespace in locales created by the generator (plone#4737) Tidy up from synch with 16.x.x (plone#4728) ...
* master: (29 commits) Remove max_line_length from .editorconfig (#4776) Fix bug showing logs at the browsers when richtext widget is use (#4780) Show expired and future content in contents view (#4764) Fix reducing expanders loaded in a subrequest (#4761) Update release notes for 16.20.5 and 16.20.6 (#4759) Release 17.0.0-alpha.7 Try to sort out volto's use of language codes (#4741) Improve .npmignore to not include not needed files/folders (#4746) Release 17.0.0-alpha.6 Control panel list SSR (#3749) Open all accordion'd content in InlineForm by default, allow arbitrarily close any number of them (#4178) Upgrade to Plone 6.0.4 (#4743) fix: unresponsive add page (#4507) Apply suggestion from browser for password field (#4524) (fix):Object.normaliseMail: Cannot read properties of null (#4558) Fix link in Volto, remove from linkcheck ignore in Documentation v6.0 (#4742) added documentation regarding the static middleware #4518 (#4736) Closes issue #4567 (#4570) Fix whitespace in locales created by the generator (#4737) Tidy up from synch with 16.x.x (#4728) ...
* typescript-support-in-core: (29 commits) Remove max_line_length from .editorconfig (plone#4776) Fix bug showing logs at the browsers when richtext widget is use (plone#4780) Show expired and future content in contents view (plone#4764) Fix reducing expanders loaded in a subrequest (plone#4761) Update release notes for 16.20.5 and 16.20.6 (plone#4759) Release 17.0.0-alpha.7 Try to sort out volto's use of language codes (plone#4741) Improve .npmignore to not include not needed files/folders (plone#4746) Release 17.0.0-alpha.6 Control panel list SSR (plone#3749) Open all accordion'd content in InlineForm by default, allow arbitrarily close any number of them (plone#4178) Upgrade to Plone 6.0.4 (plone#4743) fix: unresponsive add page (plone#4507) Apply suggestion from browser for password field (plone#4524) (fix):Object.normaliseMail: Cannot read properties of null (plone#4558) Fix link in Volto, remove from linkcheck ignore in Documentation v6.0 (plone#4742) added documentation regarding the static middleware plone#4518 (plone#4736) Closes issue plone#4567 (plone#4570) Fix whitespace in locales created by the generator (plone#4737) Tidy up from synch with 16.x.x (plone#4728) ...
Added documentation of static middleware