Developer
Supported
Sitemap Module
ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6
Back to this add-on's main page
View Other Add-ons From PutYourLightsOn
Handling Categories in Site Map URLs
Support (Resolved)
rdingus
|
Posted: 15 April 2015 01:59 PM |
|
|
|
Hi,
We have complex nested Categories defined for our Channels. URLs on our EE site are then generated in templates with the following code inside of a channel:entries tag:
{categories limit=‘1’ group_id=‘1’ parent_only=‘yes’}
{if count > 0}
<a href=”/expertise/{category_url_title}/insights/{url_title}”>
{if:else}
<a href=”#”>
{/if}
{/categories}
When I activate these channels in the site map it pulls the incorrect {category_url_title} for the URL. Is there a way to handle this within the site map plugin?
|
|
|
PutYourLightsOn
|
Posted: 16 April 2015 02:55 AM |
# 1
|
|
Developer
|
how are you entering the url for these channels in the sitemap module? the {cat_url_title} tag is supported as explained in the module preferences section of the docs.
|
|
|
rdingus
|
Posted: 16 April 2015 11:50 AM |
# 2
|
|
|
Thanks for you’re help.
I’m entering the URLs like this, per the docs: http://domain.com/expertise/{cat_url_title}/insights/{url_title}
However, this generates incorrect URLs because it inputs the wrong {cat_url_title} value.
The plugin creates this URL: http://domain.com/expertise/payment-delivery-reform/insights/new-trends-and-analysis-for-aco-participants
But the correct URL should be: http://domain.com/expertise/managed-care/insights/new-trends-and-analysis-for-aco-participants
If you look at the code sample above when we generate these URLs on the site we limit the categories to group_id=‘1’ and parent_only=‘yes’.
Is there a way to handle this?
|
|
|
PutYourLightsOn
|
Posted: 16 April 2015 11:55 AM |
# 3
|
|
Developer
|
are your entries assigned to more than one category? as per the docs: if an entry is assigned to multiple categories then only the first category will be used in parsing
|
|
|
rdingus
|
Posted: 16 April 2015 12:05 PM |
# 4
|
|
|
Ok, in some cases we have parent categories with IDs that are greater than child category IDs. In this case it is pulling the Child category as “first”. But I need to pull the parent category. Where in the plugin code can I change this? We cannot easily change the category IDs.
|
|
|
rdingus
|
Posted: 16 April 2015 02:40 PM |
# 5
|
|
|
FYI, I was able to get this working by modifying the query in mod.sitemap.php starting on line 132.
|
|
|
PutYourLightsOn
|
Posted: 05 May 2015 07:15 AM |
# 6
|
|
Developer
|
good to hear, would you mind posting your changed code here for anyone trying to do something similar in future?
|
|
|
Bhashkar Yadav
|
Posted: 23 June 2015 07:33 AM |
# 7
|
|
|
I am having the issue something like this. The site is having URL like siteurl.com/product/{parent_category}/{child_category}/{url_title}
Could you please let me know if there is any way to handle it.
Thanks,
|
|
|
PutYourLightsOn
|
Posted: 23 June 2015 08:26 AM |
# 8
|
|
Developer
|
Sorry Bhashkar, Sitemap only supports using a single category in the URL template.
|
|
|
Bhashkar Yadav
|
Posted: 23 June 2015 08:28 AM |
# 9
|
|
|
Thanks for your quick response.
Could you please help me with any hack if possible.
Thanks,
|
|
|
PutYourLightsOn
|
Posted: 23 June 2015 09:39 AM |
# 10
|
|
Developer
|
It’s actually a fairly involved change to the query (the current query uses a JOIN statement to grab the single category, whereas fetching multiple categories would require a separate query altogether) - so it’s beyond a quick hack I can offer here. To tackle it yourself, start around line 214 of mod.sitemap.php.
|
|
|
Bhashkar Yadav
|
Posted: 23 June 2015 10:06 AM |
# 11
|
|
|
Thanks for your quick response.
Yes, I did it successfully. I added a new tag {cat_breadcrumbs} and made URL like:
siteurl.com/product/{cat_breadcrumbs}/{url_title}
But found another limitation. Only one URL can be added per channel. I think, there would be facility to add more than one URL per channel.
Not sure how to resolve it at my end :( .
Thanks
|
|
|
PutYourLightsOn
|
Posted: 23 June 2015 10:12 AM |
# 12
|
|
Developer
|
Clever workaround Bhashkar.
Re: “one URL per-channel” - those are simply URL templates. Sitemap will in actuality output a sitemap node which follows that template for each entry in each channel you assign it to.
|
|
|