Frage

On my site I have the following structure:

  • Product Type
    • Product Category
      • Product

Suppose that I have a product with the following characteristics:

Product XYZ - TypeLink: "type-xyz" - CategoryLink: "category-xyz" - Link: "product-xyz" ...

The url would be for a product: /produto/type-xyz/product-xyz#category-xyz

Note that the category is nothing more than a hash in Url!

Route

Follows the definition of routes

http://mysticpaste.com/private/kXhF9FFLbw/

Attention: The routes are working perfectly! I'm listing just to show better the understanding

Sitemap

To display sitemap using the following command:

razor @Html.MvcSiteMap().SiteMapPath()

Dynamic

Product Types: http://mysticpaste.com/private/yzOR1d0kr9/

Product Categories: http://mysticpaste.com/private/YzWvrYOt6J/

Products: http://mysticpaste.com/private/eDbfxmWAXU/

Mvc.sitemap

http://mysticpaste.com/private/2PztbFuDIs/

If you need the complete code of the sitemap: http://mysticpaste.com/private/JPKOg1a6g9/

Web.config

http://mysticpaste.com/private/8WpRGvc7Cq/

Problem

My problem is that the sitemap is not displaying the titles and links correctly! This site is published in this link. http://datafilme.bindsolution.com/ As an example, you can open the product page "Website da Datafilme"

http://datafilme.bindsolution.com/Produto/software/website-da-datafilme

As you can see, the link is correct! But the sitemap display data from another product!

War es hilfreich?

Lösung

The Product Types (ProdutoTipoDynamicNodeProvider) needs to set the key property on the created dynamic nodes.

Product Categories (ProdutoCategoriaDynamicNodeProvider) also needs to set the key property, but the parentKey property must also be set to the key of the product type node.

The Products (ProdutoDynamicNodeProvider) must set the parentKey property to the key of the category node, but setting key is not necessary as the dynamically generated key is okay, when there is no child nodes.

On you site the hierarchy, with keys and parent keys could be (below the productos node):

Scanner de documento                 (key = "scanner")
  Conexões de Rede                   (key = "conexoes", parentKey = "scanners")
    Authoritatively-Disintermediate  (parentKey = "conexoes")
    Super-scanner                    (parentKey = "conexoes")
    Scanner XYZ                      (parentKey = "conexoes")
Equipamentos de microfilmagem        (key = "microfilmagem")
Software                             (key = "software")
  Digitalizacao                      (key = "digitalizacao", parentKey = "software")
    Website da Datafilme             (parentKey = "digitalizacao")
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top