Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/volto/news/8397.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix path used for rendering blocks in the `NewsItemView`. @TimoBroeskamp
8 changes: 5 additions & 3 deletions packages/volto/src/components/theme/View/NewsItemView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Container as SemanticContainer } from 'semantic-ui-react';
import { hasBlocksData } from '@plone/volto/helpers/Blocks/Blocks';
import { flattenHTMLToAppURL } from '@plone/volto/helpers/Url/Url';
import { flattenHTMLToAppURL, getBaseUrl } from '@plone/volto/helpers/Url/Url';
import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
import config from '@plone/volto/registry';

Expand All @@ -17,14 +17,16 @@ import config from '@plone/volto/registry';
* @params {object} content Content object.
* @returns {string} Markup of the component.
*/
const NewsItemView = ({ content }) => {
const NewsItemView = (props) => {
const { content, location } = props;
const path = getBaseUrl(location?.pathname || '');
const Image = config.getComponent({ name: 'Image' }).component;
const Container =
config.getComponent({ name: 'Container' }).component || SemanticContainer;

return hasBlocksData(content) ? (
<Container id="page-document" className="view-wrapper newsitem-view">
<RenderBlocks content={content} />
<RenderBlocks {...props} path={path} />
</Container>
) : (
<Container className="view-wrapper">
Expand Down
Loading