Skip to content

Slug attribute of product data #21125

@unru006

Description

@unru006

We are using the slug attribute of the product object to construct the url in the routing like:

  routing: {
    routes: {
      product: {
        paths: ['product/:productCode/:name', 'product/:productCode'],
        paramsMapping: { productCode: 'code', name: 'slug' },
      },
    },
  },

In the default implementation the slug is filled by the ProductNameNormalizer which replaces some special characters.
According to this comment:

  /**
   * The product slug is used to create pretty URL for links to product detail pages.
   *
   * The slug typically avoid spaces (`%20`) or other characters that are encoded in the URL.
   */
  slug?: string;

the slug should encode characters like " or space as well. But sadly, it does not.

Two improvement ideas:

  • Add correct url encoding in the default implementation as well.
  • Use the slug in the default routing config of product urls, so that no customization is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions