Page 1 of 1

CGBlog summary & detail templates with Pretty URL's

Posted: Sun May 28, 2017 5:20 pm
by wmdvanzyl
Greetings.

CMSMS Version 2.1.6


I have a page where i am showing blog articles from different categories and i would like them to be displayed with different summary templates. What's more is each category has an associated details template. I want to call it like this:

Code: Select all

<section class="main items">
  {CGBlog category="Portfolio" summarytemplate="PortfolioSummary" detailtemplate="PortfolioDetail" }           
</section>
        
<section class="main ArchBlogPostItems">
 {CGBlog category="Articles" summarytemplate="BlogSummary" detailtemplate="BlogDetail" }    
</section>
But this doesn't work. I found this in the Module Help section, but i'm not sure it applies to this scenario:

Code: Select all

Pretty URLS are ideal for websites where search engine optimization is a real concern. It provides a shorter, friendlier URL that search engines will treat better, and that are easier to share. However they come at a cost. Particularly, many of the parameters specified in the call to CGBlog, that should be passed down to another view via a link cannot be passed on a pretty url.

For example, when pretty urls are not enabled it is possible to call the browsecat action like this: {CGBlog action=browsecat summarytemplate=somesummary detailtemplate=somedetail detailpage=mydetailpage pagelimit=25 sortby=cgblog_extra sortorder=asc}. Now when the browsecat action generates its display, including links to summary views for each category, it should pass the summarytemplate,detailtemplate,detailpage,paglimit,sortby, and sortorder parameters along on the URL For the resulting summary view to use. However, it is not possible to pass these parameters on a pretty URL, and to keep them "pretty"

To that end, it is possible to provide default values for most of these parameters via the CGBlog admin console. This however, limits the flexibility of the module in some ways. Another possibility is to use the {cge_module_hint} tag to provide behavioral hints to the module on destination pages.
Checking CGExtensions Module help i found this:

Code: Select all

{cge_module_hint module=CGBlog detailtemplate=sports}
I tried adding this to the "Smarty data or logic that is specific to this page" section and the top of the templates where the call is made, but nothing works.

So my questions is, is it possible to do i want to? And if so, how?

Re: CGBlog summary & detail templates with Pretty URL's

Posted: Sun May 28, 2017 7:50 pm
by calguy1000
If you are using URL slugs for each article, you are out of luck.

But if you are not, and your detail pretty URL's look something like blog/45/21/some-text (one of the digits is the page id, the other the article id) then you can:

a: Use a separate detail page for each category. Remember the alias for this page. Lets call it 'fooPage'.
b: In that page, in the 'smarty data/logic specific to the page' use something like:
{cge_module_hint module=CGBlog detailtemplate=fooDetail}
c: In the page where you are calling CGBlog summary view multiple times. You can use something like:
{CGBlog category='foo' detailpage='fooPage'} (where fooPage is the alias from step a above).

Note: for SEO purposes, you should ensure that that the articles in each category ALWAYS link to the same appropriate detail page. So that the canonical URL is always consistent.

CMSMS and CGBlog do not care where or how you display data, but search engines do.

Re: CGBlog summary & detail templates with Pretty URL's

Posted: Sun May 28, 2017 8:19 pm
by Rolf
calguy1000 wrote:Note: for SEO purposes, you should ensure that that the articles in each category ALWAYS link to the same appropriate detail page. So that the canonical URL is always consistent.
https://www.cmscanbesimple.org/blog/bas ... d-metatags

Re: CGBlog summary & detail templates with Pretty URL's

Posted: Sun May 28, 2017 8:24 pm
by wmdvanzyl
Thank you for the response.
calguy1000 wrote:If you are using URL slugs for each article, you are out of luck.
How can i be sure that i am not using URL slugs?

I have followed your orders, but i have not met with success Ceaser! :P

But you are right on the money as to where the issue lies. I went into CGBlog and changed the default detail page. That value overrides everything else. So it is only using that value. Clearly, i have messed something up somewhere...
Rolf wrote:https://www.cmscanbesimple.org/blog/bas ... d-metatags
Thanks Rolf! I will definitely look at this.