• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Canonical URLS correct with CGBlog
PostPosted: Tue Jun 13, 2017 5:37 pm 
Offline
Forum Members
Forum Members

Joined: Fri May 06, 2011 12:48 pm
Posts: 204
This is a continuation of https://forum.cmsmadesimple.org/viewtopic.php?f=7&t=76665

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.


Rolf wrote:
https://www.cmscanbesimple.org/blog/bas ... d-metatags


Since i am forced to not use the slugs for detail templates, i have to get the canonical url correct. (As stated by the guru's above.)

I am seeing that i am missing a part of the url in my canonical url.

The URL is
Code:
https://modh.co.za/blog/10/48/7-KEY-ASPECTS-WHEN-BUILDING-YOUR-FIRST-HOME


But my canonical URL is
Code:
https://modh.co.za/blog/10/7-key-aspects-when-building-your-first-home


@Rolf, i used your website linked above as guidance (amazing help by the way). I have this in my template:
Code:
<link rel="canonical" href="{$canonical_url}" />

and this in my blog detail template:
Code:
{$canonical_url = $entry->canonical|lower scope=global}


TL;DR: Why is that '/48' being stripped from the canonical URL? Is this correct?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Canonical URLS correct with CGBlog
PostPosted: Tue Jun 13, 2017 7:19 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7213
Location: The Netherlands
This part lowers the case in the url:
{$canonical_url = $entry->canonical|lower scope=global}
Remove this and the url stays uppercase

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Canonical URLS correct with CGBlog
PostPosted: Tue Jun 13, 2017 8:25 pm 
Offline
Forum Members
Forum Members

Joined: Fri May 06, 2011 12:48 pm
Posts: 204
Rolf wrote:
This part lowers the case in the url:
{$canonical_url = $entry->canonical|lower scope=global}
Remove this and the url stays uppercase


Thanks, i got that. But i struggle wrapping my head around canonical URL's. If i have 10 blog posts, do they all have the same canonical URL (the blog page they are on) or should they have 10 separate canonical URL's? The latter is what i understand it to be. Canonical URL should be a valid URL that is the final/correct/only/real location for a specific piece of web content. This is so that search engines can correctly identify all the different variations that are essentially the same piece of content. That's my understanding. So every blog post should have a unique URL. The slug is great for this, but since i can't use that, i have to identify it by page id and article id. But we are only using the page id... So wouldn't every blog post then have the exact same canonical url - and that can't be right, can it?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Canonical URLS correct with CGBlog
PostPosted: Tue Jun 13, 2017 8:51 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7213
Location: The Netherlands
I cant see what is wrong with the provided information, but I can guarantee the method described at my blog works for 100%
https://www.cmscanbesimple.org/blog/bas ... d-metatags

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Canonical URLS correct with CGBlog
PostPosted: Tue Jun 13, 2017 9:01 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 2722
Location: The Netherlands
The canonical url which is generated indeed differs from the url generated by CGBlog for the 'more url'. The latter contains the page id (returnid) while the canonical url is lacking that id.

I guess that's what you mean?

BTW: those canoncical urls do lead to a working page and seem to be unique per article.

Why the more-url and canonical url differ I don't know.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Canonical URLS correct with CGBlog
PostPosted: Wed Jun 14, 2017 7:03 am 
Offline
Forum Members
Forum Members

Joined: Fri May 06, 2011 12:48 pm
Posts: 204
velden wrote:
The canonical url which is generated indeed differs from the url generated by CGBlog for the 'more url'. The latter contains the page id (returnid) while the canonical url is lacking that id.

I guess that's what you mean?

BTW: those canoncical urls do lead to a working page and seem to be unique per article.

Why the more-url and canonical url differ I don't know.


@Rolf @velden - Thanks for the responses.

The page it directs to, however, is the default CGBlog page, so it doesn't have the correct template applied. This again comes back to the issue of pretty URL's / slugs and CGBlog. I totally get that it can't be done, i'm just trying to find a work-around. Will it matter that the article now looks wrong? Is there a way to manipulate the page id to be the one i want it to use? I am referring to this:
Code:
{cge_module_hint module=CGBlog detailtemplate=sports}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Canonical URLS correct with CGBlog
PostPosted: Wed Jun 14, 2017 9:01 am 
Offline
Forum Members
Forum Members

Joined: Fri May 06, 2011 12:48 pm
Posts: 204
It seems that the canonical url doesn't have the page id in it. It only has the article id. So therefor it displays the article on the default blog detail page, which is exactly what i don't want.

Is there a way to append the page id to the canonical url in the template?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Canonical URLS correct with CGBlog
PostPosted: Wed Jun 14, 2017 11:54 am 
Offline
Forum Members
Forum Members

Joined: Fri May 06, 2011 12:48 pm
Posts: 204
Code:
{assign var='unique_identifier' value=$entry->id scope=global}
{*{$canonical_url = $entry->canonical|lower scope=global}*}
{$canonical_url = $canonical_url|cat:"/$unique_identifier/$page_id" scope=global}


I think this might be what i was after. I manually build the canonical url and include both the correct article id and page id. Now my canonical url reads:

Code:
<link rel="canonical" href="https://modh.co.za/arch-blog/11/48/"/>


And that links to the correct article with the correct template applied. It doesn't have the article name at the end, but it doesn't seem to mind. WIll still figure out how to add that.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Canonical URLS correct with CGBlog
PostPosted: Wed Jun 14, 2017 12:45 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 2722
Location: The Netherlands
Not having the article id might have negative impact regarding SEO (don't know for sure).

I'm not sure if this behavior (not including the return/page id) is by design or a bug. I could imagine why it is by design.

Does the detail action (template) have the $more_url (or similar) available? You could check by inserting the {get_template_vars} tag inside the detail template.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: googlebot


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting