Michelle
Michelle

Reputation: 249

Kentico - Content Only page & smart search result

I have a custom page types (Content Only) for Locations. Then I have a landing page (/company/locations/) with repeater to list all locations and their details. Things work well so far. Now, after adding the smart search, I notice that if I search a location name like "san francisco", the landing page didn't show up in search result, but the content-only page showed with a URL like this /company/locations/san-francisco. The thing is, this URL results in 404 since that page doesn't really exist. What should I do? Should I re-create the page type and change it to a regular page instead of content only before it's too late? Or is there a way to make individual location url (/company/locations/san-francisco) work - considering we can't specify a page template to go with content only page type? Thanks!

Upvotes: 0

Views: 458

Answers (2)

Trevor F
Trevor F

Reputation: 1437

There are multiple types of Search indexes in Kentico.

"Pages" scans the data of a document, such as any webparts+properties, editable text, form data, etc. They do NOT scan the rendering on the page though, it doesn't catch any Repeaters (what you're using).

"Page Crawler" will literally load the page, and scan all the content in the page. This will catch Repeaters and dynamic content like that.

Knowing this, you have a couple options.

  1. Use Pages, then Modify the Smart Search Result and add some transformation logic to say something like the below

<a href="<% IfCompare(GetSearchValue("ClassName"), "custom.Location", "/company/locations", SearchResultUrl())%>">The Link</a>

  1. Use Page Crawler, tell it specifically to only index the /company/locations.
  2. Use Page Crawler, and also a custom smart search indexer so you can exclude the header/footer or other areas out of the content (it's a bit more advanced)

Upvotes: 2

Brenden Kehren
Brenden Kehren

Reputation: 6117

If you don't want that URL to show then simply exclude those page types from that search index. But if you want them to specifically show, then create a detail or selected transformation for that /company/locations repeater to display when someone navigates to it from the search. This will also be good for google and other search indexes if you plan to have specifics for each location.

Upvotes: 1

Related Questions