Magento 2 PWA remove .html Prefix
-
14-04-2021 - |
Frage
How can I remove .html prefix from Venia Concept Product URL Suffix and Category URL Suffix as my magento instance doesn't have an sufix set and I thought it would pick it up from the settings but it looks like it isn't ?
Thanks
Lösung
I'v found out that looks like it's hard coded in ../pwa-studio/packages/venia-ui/lib/components/CategoryTree/categoryLeaf.js
.
import React from 'react';
import { func, shape, string } from 'prop-types';
import { useCategoryLeaf } from '@magento/peregrine/lib/talons/CategoryTree';
import { mergeClasses } from '../../classify';
import { Link, resourceUrl } from '../../drivers';
import defaultClasses from './categoryLeaf.css';
const suffix = '.html';
const Leaf = props => {
const { category, onNavigate } = props;
const { name, url_path } = category;
const classes = mergeClasses(defaultClasses, props.classes);
const { handleClick } = useCategoryLeaf({ onNavigate });
const destination = resourceUrl(`/${url_path}${suffix}`);
return (
<li className={classes.root}>
<Link
className={classes.target}
to={destination}
onClick={handleClick}
>
<span className={classes.text}>{name}</span>
</Link>
</li>
);
};
export default Leaf;
Leaf.propTypes = {
category: shape({
name: string.isRequired,
url_path: string.isRequired
}).isRequired,
classes: shape({
root: string,
target: string,
text: string
}),
onNavigate: func.isRequired
};
And for product urls they are in :../pwa-studio/packages/venia-ui/lib/components/Gallery/item.js
This one has a TODO so I'm assuming it will come from magento instance settings:
...
// TODO: get productUrlSuffix from graphql when it is ready
const productUrlSuffix = '.html';
...
I Do think this really should be using settings of the Magento instance it connected to!
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange