You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Sitefinity博客URL配置:如何将文章分类名称纳入URL?

Fixing Custom URL with Category Name in Your URL Provider

Hey there, let's sort out this URL configuration issue you're running into. I've dealt with similar problems using Telerik/Sitefinity's URL providers before, so here's what's going on and how to fix it:

Why Your Current Attempts Aren't Working

  • When you used /[Category]/[UrlName], you got that weird Telerik.OpenAccess.TrackedList%601[System.Guid] string because Category is actually a collection of categories (TrackedList is OpenAccess's way of handling related items), not a single category. Calling it directly just outputs the collection's type name instead of the category title.
  • Using /[Category.Title]/[UrlName] threw an error for the same reason: the Category collection doesn't have a Title property—only individual category items do.

Correct Way to Include Category Name in URLs

Assuming your content items (like blog posts or news) have a primary category (most setups do), use the PrimaryCategory property instead, which points to the single main category for the item. Here's the correct URL pattern:

/[PrimaryCategory.Title]/[UrlName]

If you prefer a SEO-friendly, cleaned-up version of the category name (instead of the raw title which might have spaces/special characters), use the category's UrlName property instead:

/[PrimaryCategory.UrlName]/[UrlName]

Finding Available Parameters for URL Patterns

There's no single "official cheat sheet" that lists every possible parameter, but here's how to find all valid properties you can use:

  • Go to your CMS backend (e.g., Sitefinity) and navigate to the content type you're working with (e.g., Blog Posts, News Items).
  • Open the Field Definitions for that content type. Every public property (including related fields like categories, authors, etc.) is fair game for URL patterns.
  • For related items (like categories), you can drill into their properties using dot notation—e.g., PrimaryCategory.Title, PrimaryCategory.Description, Author.FullName, etc.

If you need to handle multi-category items (where an item has multiple categories and you want to include one in the URL), you'll likely need to write a custom URL provider class instead of relying on the built-in pattern. But for most single-category use cases, the PrimaryCategory approach works perfectly.

内容的提问来源于stack exchange,提问作者Randy Hall

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 06:33:07