Hi
There was a previous post
viewtopic.php?f=8&t=81636&p=344063&hilit=news+pretty+urls#p344063
That noted that they were getting a suffix to the url when using pretty urls with news stories.
/news/68/98/my-article-is-cool/d,news-article.html
I had the same until I made the detail template the default. I wondered if this was a bug?
News showing template in url when using pretty urls
Re: News showing template in url when using pretty urls
I don't think it is a bug, Howey. I, too encountered a similar problem recently and I posted to this forum earlier this month:
viewtopic.php?f=8&t=82103
I also answered my post.
I found that even if you set the default news detail page in News setting but also included the detailtemplate parameter in the News tag, it will show the detail suffix at end of URL.
I think this means that you could override the default setting if you wanted to show another news detail template for that particular News tag call.
viewtopic.php?f=8&t=82103
I also answered my post.
I found that even if you set the default news detail page in News setting but also included the detailtemplate parameter in the News tag, it will show the detail suffix at end of URL.
I think this means that you could override the default setting if you wanted to show another news detail template for that particular News tag call.
Re: News showing template in url when using pretty urls
Hi
I solved this the same way, set the detail template as default. It does mean however if I want to use other templates on another page I run into the same problem.
I your post you said you used the url (slug). I had a problem with this, when a value is entered the detail template shows in the default page ie home page. This was mitigated by setting a default page to display the news?
I was trying to format og: values in the head as well. All got very frustrating so I have settled on the default page being set for the news items in the News admin and the detail template set as default. I am using the News module to display "jobs" on another page, just using a different category. But not using url (slug). I can live with the odd formatting on this page.
Ideally, it would be good to be able to set different templates, detail page and url (slugs), but this has been beyond me.
Even with these minor frustrations I still think CMS Made Simple is fab. Just the flexibility and ease of implementation is great.
I solved this the same way, set the detail template as default. It does mean however if I want to use other templates on another page I run into the same problem.
I your post you said you used the url (slug). I had a problem with this, when a value is entered the detail template shows in the default page ie home page. This was mitigated by setting a default page to display the news?
I was trying to format og: values in the head as well. All got very frustrating so I have settled on the default page being set for the news items in the News admin and the detail template set as default. I am using the News module to display "jobs" on another page, just using a different category. But not using url (slug). I can live with the odd formatting on this page.
Ideally, it would be good to be able to set different templates, detail page and url (slugs), but this has been beyond me.
Even with these minor frustrations I still think CMS Made Simple is fab. Just the flexibility and ease of implementation is great.
Re: News showing template in url when using pretty urls
Did you check: https://docs.cmsmadesimple.org/tags/cms ... odule_hint ?
The point here is: you can't have a pretty url ánd put all needed parameters in it.
So I think you should get an url to a specific page (ID, which I guess is one of the numbers in the pretty url) and on that page use the cms_module_hint tag to tell the News module what template to use for that specific page.
You can put the {cms_module_hint} tag in the 'Smarty data or logic that is specific to this page' field of the page.
Then verify your template uses the {process_pagedata} tag too.
The point here is: you can't have a pretty url ánd put all needed parameters in it.
So I think you should get an url to a specific page (ID, which I guess is one of the numbers in the pretty url) and on that page use the cms_module_hint tag to tell the News module what template to use for that specific page.
You can put the {cms_module_hint} tag in the 'Smarty data or logic that is specific to this page' field of the page.
Then verify your template uses the {process_pagedata} tag too.
Re: News showing template in url when using pretty urls
Hi
Operator error maybe?
I tried adding the code to both the Smarty logic for the page and also directly within the template just below the process_pagedata. and removed the param from the News tag
It rendered the correct template, but I still had the /d,08_jobsdetail at the end of the url when viewed.
I am specifying the detail page, because I have set the default to the News page, so this should render to the content tag on the same page as the news tag used for jobs.
Am I missing something obvious?
Operator error maybe?
I tried adding the code to both the Smarty logic for the page and also directly within the template just below the process_pagedata. and removed the param from the News tag
Code: Select all
{cms_module_hint module=News detailtemplate=08_jobsdetail}
I am specifying the detail page, because I have set the default to the News page, so this should render to the content tag on the same page as the news tag used for jobs.
Code: Select all
{news summarytemplate="08_jobssumm" category="Jobs" detailpage="careers"}
Re: News showing template in url when using pretty urls
Note it should be in the Smarty logic of the target page only (careers). There you want to tell the News module to use the specific template.
Re: News showing template in url when using pretty urls
Hi
I'll double check, but I did just put it in the "page" smarty logic first. When that didn't work I tried it in the template.
I will try again as the only thing I didn't do is clear the cache inbetween times.
I'll double check, but I did just put it in the "page" smarty logic first. When that didn't work I tried it in the template.
I will try again as the only thing I didn't do is clear the cache inbetween times.
Re: News showing template in url when using pretty urls
When I put cms_module_hint in "Smarty data or logic that is specific to this page:" a get the correct detailtemplate because I typed some quotes around the detailtemplate name:
With Pretty urls active.
Code: Select all
{cms_module_hint module=News detailtemplate='my_detail_template'}