Skip to content

Commit

Permalink
fix: client and server warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshgulia1 committed May 16, 2024
1 parent dd553b8 commit d66b0ac
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
20 changes: 16 additions & 4 deletions packages/volto/src/helpers/Html/Html.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class Html extends Component {
const head = Helmet.rewind();
const bodyClass = join(BodyClass.rewind(), ' ');
const htmlAttributes = head.htmlAttributes.toComponent();
const shouldPrefix =
config.settings.prefixPath && process.env.NODE_ENV === 'production';

return (
<html lang={htmlAttributes.lang}>
Expand Down Expand Up @@ -121,22 +123,32 @@ class Html extends Component {

<link
rel="icon"
href={(config.settings.prefixPath ?? '') + '/favicon.ico'}
href={
(shouldPrefix ? config.settings.prefixPath : '') + '/favicon.ico'
}
sizes="any"
/>
<link
rel="icon"
href={(config.settings.prefixPath ?? '') + '/icon.svg'}
href={
(shouldPrefix ? config.settings.prefixPath : '') + '/icon.svg'
}
type="image/svg+xml"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href={(config.settings.prefixPath ?? '') + '/apple-touch-icon.png'}
href={
(shouldPrefix ? config.settings.prefixPath : '') +
'/apple-touch-icon.png'
}
/>
<link
rel="manifest"
href={(config.settings.prefixPath ?? '') + '/site.webmanifest'}
href={
(shouldPrefix ? config.settings.prefixPath : '') +
'/site.webmanifest'
}
/>
<meta name="generator" content="Plone 6 - https://plone.org" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down
2 changes: 1 addition & 1 deletion packages/volto/src/server.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ server.get('/*', (req, res) => {
config.settings.prefixPath &&
process.env.NODE_ENV === 'production'
? config.settings.prefixPath
: '/'
: undefined
}
>
<ReduxAsyncConnect routes={routes} helpers={api} />
Expand Down
5 changes: 4 additions & 1 deletion packages/volto/src/start-client.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import configureStore from '@plone/volto/store';
import { Api, persistAuthToken, ScrollToTop } from '@plone/volto/helpers';

export const history = createBrowserHistory({
basename: config.settings.prefixPath,
basename:
config.settings.prefixPath && process.env.NODE_ENV === 'production'
? config.settings.prefixPath
: '/',
});

function reactIntlErrorHandler(error) {
Expand Down

0 comments on commit d66b0ac

Please sign in to comment.