Search code examples
sitefinitysitefinity-4

How can I get/show Blog Post Permalinks in Sitefinity?


In my Sitefinity 4.3 based site, I have a blog set up using the standard Blog content module and widget templates. Blog posts are categorized, among other things, by the product they relate to.

The URL structure is like:

/blog_template_page/blog_category_template_page/2012/01/01/post-name

Each blog post has at least two categories:

  1. blog_category (so I can put similar types of articles together in the blog archive)
  2. product_category (so I can relate blog posts to products we sell)

Elsewhere on the site, I have Pages that make up a product catalog. On the page for Product X, I would like to show a list of blog posts that have a product_category of Product X. When a user clicks to read a blog post, they should go to the original blog URL above (the permalink for the blog post).

How can I get the Sitefinity blog list widget to generate URLs to the original blog post location?

As far as I can tell, Sitefinity gives me two options: use the current page as a template for the blog post (which I don't want to do, since I'm in a catalog page). Or use another page in the site as a template (which I don't want to do, since I'll be at a whole new URL).

Put another way...

What I would LIKE to do: On the main product page for Product X, I'd like to show a dynamic list that links to the original blog posts. I could create a new single blog post template and render the content through the new template, but that would give me new URLs. I really just want the Blog List to generate links to the blog posts in their original location.

In wordpress, I'd use the_permalink(); in my blog list template. Is there something similar in Sitefinity?

Double points if there's a way for me to design/accomplish this from the backend admin pages, instead of from code. But anything is better than nothing.


Solution

  • I think the single-line answer to your question is: There is no default location for blog posts.

    Sitefinity's architectue basically allows any content to be put on any page. Absolute URLs for items are formed from BOTH of these (page and item-specific URL). So a single blog post can have an unlimited number of URLs, depending on the page you're viewing it on.

    This is a design decision and I understand it may be confusing. What you can do, however, is to decide that one of these URLs (using a specific page), will be the default one. Then if you want all places where you list blog posts to point to this default, just setup the BlogPosts widget to always point to that specific page for a single post.

    You can configure what appears in the item-specific URL, but you cannot control the page part - that is always the current page you are viewing. More information about URLs you can find in a couple of blog posts I've written:

    Custom URL formats for Sitefinity content modules
    URL filtering in built-in content widgets
    URL filtering with multiple content widgets per page

    If you have further questions, you can write in our forums, or directly to me (slavo dot ingilizov at telerik dot com).

    Regards,
    Slavo
    The Sitefinity Team.