frontends: [BUG] Hrefs of internal links in CMS elements are broken

Current Behavior

I want to link to product detail pages, category pages, and media files from rich text CMS elements. In Frontends, those three type of links are broken.

The href of the product link becomes 124c71d524604ccbad6042edce3ac799/detail/0194efe149357110b932d87d97b48858#

<a class="underline text-base font-normal text-primary hover:text-secondary-900" target="_self" href="124c71d524604ccbad6042edce3ac799/detail/0194efe149357110b932d87d97b48858#">Product Link</a>

The href of the category link becomes [object Object]

<a class="underline text-base font-normal text-primary hover:text-secondary-900" target="_self" href="[object Object]">Category Link</a>

The href of the media file link becomes 124c71d524604ccbad6042edce3ac799/mediaId/0194efe1a4c273eb8fccc42ac30ffdbe#

<a class="underline text-base font-normal text-primary hover:text-secondary-900" target="_self" href="124c71d524604ccbad6042edce3ac799/mediaId/0194efe1a4c273eb8fccc42ac30ffdbe#">File Link</a>

Expected Behavior

The href should be resolved to the SEO url for the product and category links, and to the media url for the file link.

Steps To Reproduce

Add a text block to a layout in Shopping Experience and add links of types “Product”, “Category”, and “File” in the rich-text editor. Image

Anything else?

I think this is the original issue that introduced the category url resolver (which is now broken): https://github.com/shopware/frontends/issues/411

Also note that 124c71d524604ccbad6042edce3ac799 seems to be a constant that is used throughout the Shopware backend as a the seoUrlReplacePrefix: https://github.com/search?q=repo%3Ashopware%2Fshopware 124c71d524604ccbad6042edce3ac799&type=code

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

A disadvantage of getConfigValue is that it won’t work for mapped config values (see the composable) and variables like {{ category.name }} won’t be interpolated because the responsible resolvers in the core all write to data.

Maybe the oversight here has been that data has been mistaken as the “original” content from admin that shouldn’t be modified, when in reality config is the original? (See here in the changelog from the linked issue above

I believe this issue could be addressed either in the Core or in the Frontend, depending on the intended semantics of the data field in CMS slot elements.

Problem

In components like CmsElementText, the frontend resolves content via the data property:

const mappedContent = computed<string>(() => {
  return props.content?.data?.content || getConfigValue("content");
});

However, when CMS content is dynamically updated—for example, via a CmsPageLoadedEvent subscriber—the updated HTML is injected into the config and translated.config fields, not into data. This leads to outdated content being rendered in the Storefront or Store API responses.

Example

Here’s a simplified payload of a CMS slot where: • data.content still contains the original (unmodified) HTML. • config.content and translated.config.content contain the correct (modified) HTML.

"data": {
  "content": "<a href=\"...UNMODIFIED...\">"
},
"config": {
  "content": {
    "value": "<a href=\"...MODIFIED...\">",
    "source": "static"
  }
},
"translated": {
  "config": {
    "content": {
      "value": "<a href=\"...MODIFIED...\">",
      "source": "static"
    }
  }
}

Open Question

What is the intended role of data.content? • Should it represent the original static content (as persisted)? • Or should it reflect the resolved, final content as interpreted after configuration and translation?

Depending on that semantic, a fix could be: • Frontend-side: Fall back to translated.config.content first, then config, and only then data. • Core-side: Ensure that data.content is kept in sync with transformed content (e.g., for text-editor slots).

This ambiguity might also apply to other slot types like image, manufacturer-logo, etc., where similar link rewriting might be needed.