Login

Username

Password





Register   Reset password

Get Cuyahoga at SourceForge.net. Fast, secure and Free Open Source software downloads

Forum

Welcome Guest Search | Active Topics | Members

SEO Friendly News Articles? Options
jimmyfingers
Posted: Wednesday, April 1, 2009 7:37:45 AM
Rank: Advanced Member
Groups: Member

Joined: 12/23/2008
Posts: 42
Points: 126
Hi,

We have recently been asked by our SEO company if we can change the url of our news articles to more friendly ones like the other pages within our Cuyahoga website. Rather than http://MyWebsite.aspx/79/section.aspx/46 it should be something like http://MyWebsite.aspx/articles/InsuranceArticle

Are there any plans to introduce more SEO friendly article titles in the future? In not is anyone able to advise me on the best way of going about this?

Many thanks
martijnb
Posted: Thursday, April 2, 2009 12:04:14 AM

Rank: Administration
Groups: Administration , Member

Joined: 12/30/2004
Posts: 1,674
Points: 1,824
Location: Wageningen (NL)
Yes, that's a good one. I've been looking to improve this for a while, but it's not easy.
The point is that a page can contain multiple sections (modules), so we always have to supply the sectionid in the url, so that Cuyahoga knows which module is the active module. Let's say we have a page called /articles.aspx. To view a single article, we can't just add the title to the url like /articles/the-title-of-my-article.aspx, because there is no way that Cuyahoga can guess that we want to view the details of the article with title 'the-title-of-my-article' instead of a child page under articles.aspx.

A workaround might be to modify the articles module and add the title to the pathinfo like: http://mywebsite/79/section.aspx/46-the-title-of-my-article or http://mywebsite/79/section.aspx/the-title-of-my-article.

Constructor
Posted: Sunday, April 5, 2009 12:32:16 PM
Rank: Administration
Groups: Administration , Member

Joined: 10/7/2008
Posts: 505
Points: 1,515
martijnb wrote:

A workaround might be to modify the articles module and add the title to the pathinfo like: http://mywebsite/79/section.aspx/46-the-title-of-my-article or http://mywebsite/79/section.aspx/the-title-of-my-article.


Would that be difficult to implement? Either using the title of the article or adding an new SEOId which would be a unique string consisting of lower case a-z and 0-9 with maybe hyphens allowed? Using filtered input and validation to ensure formatting and uniqueness.

That does sound good. I may have a look and a think.
martijnb
Posted: Sunday, April 5, 2009 11:22:57 PM

Rank: Administration
Groups: Administration , Member

Joined: 12/30/2004
Posts: 1,674
Points: 1,824
Location: Wageningen (NL)
I don't think it would be too difficult to implement. We already have a simple algorithm that creates the friendly url's when adding a new page, so perhaps you could borrow from that.
jimmyfingers
Posted: Tuesday, April 7, 2009 12:33:46 AM
Rank: Advanced Member
Groups: Member

Joined: 12/23/2008
Posts: 42
Points: 126
Ok I've sorted it in quite a simple way. In the rptArticles_ItemDataBound method of Articles.ascx.cs, I changed:
string articleUrl = UrlHelper.GetUrlFromSection(this._module.Section) + "/" + article.Id;
to
string articleUrl = UrlHelper.GetUrlFromSection(this._module.Section) + "/" + article.Id + "/" + article.Title.Replace(" ","-"wink ;

This will give the SEO friendly url example of http://www.mywebsite.com/79/section.aspx/46/Article-About-Cuyahoga-stuff
Constructor
Posted: Tuesday, April 7, 2009 4:23:44 AM
Rank: Administration
Groups: Administration , Member

Joined: 10/7/2008
Posts: 505
Points: 1,515
jimmyfingers wrote:
Ok I've sorted it in quite a simple way. In the rptArticles_ItemDataBound method of Articles.ascx.cs, I changed:
string articleUrl = UrlHelper.GetUrlFromSection(this._module.Section) + "/" + article.Id;
to
string articleUrl = UrlHelper.GetUrlFromSection(this._module.Section) + "/" + article.Id + "/" + article.Title.Replace(" ","-"wink ;

This will give the SEO friendly url example of http://www.mywebsite.com/79/section.aspx/46/Article-About-Cuyahoga-stuff


Cool, nice and quick.

This can cause errors though with unsafe/reserved url characters.

This may not be the best way but it works:

Code:
//original// string articleUrl = UrlHelper.GetUrlFromSection(this._module.Section) + "/" + article.Id + "/";

string seoArticleUrl = UrlHelper.GetUrlFromSection(this._module.Section)
                    + "/" + article.Id
                    + "/" + article.Title.Replace(" ","-").ToLower();
// replace spaces with dashes
seoArticleUrl = Regex.Replace(seoArticleUrl, "[^A-Za-z0-9-/._]", "");
// strip all illegal characters like punctuation
string articleUrl = seoArticleUrl;


Also regarding:
martijnb wrote:
We already have a simple algorithm that creates the friendly url's when adding a new page, so perhaps you could borrow from that.


Can you point in general direction to where?
martijnb
Posted: Tuesday, April 7, 2009 7:04:32 AM

Rank: Administration
Groups: Administration , Member

Joined: 12/30/2004
Posts: 1,674
Points: 1,824
Location: Wageningen (NL)
Constructor wrote:

martijnb wrote:
We already have a simple algorithm that creates the friendly url's when adding a new page, so perhaps you could borrow from that.


Can you point in general direction to where?


CreateShortDescription() in the Node class, but looking at your code example, you already found that one happy.
Constructor
Posted: Tuesday, April 7, 2009 9:44:19 AM
Rank: Administration
Groups: Administration , Member

Joined: 10/7/2008
Posts: 505
Points: 1,515
martijnb wrote:
Constructor wrote:

martijnb wrote:
We already have a simple algorithm that creates the friendly url's when adding a new page, so perhaps you could borrow from that.


Can you point in general direction to where?


CreateShortDescription() in the Node class, but looking at your code example, you already found that one happy.


That is remarkable. The code is almost identical. The code I posted was not from there!
martijnb
Posted: Wednesday, April 8, 2009 7:20:35 AM

Rank: Administration
Groups: Administration , Member

Joined: 12/30/2004
Posts: 1,674
Points: 1,824
Location: Wageningen (NL)
Constructor wrote:
martijnb wrote:
Constructor wrote:

martijnb wrote:
We already have a simple algorithm that creates the friendly url's when adding a new page, so perhaps you could borrow from that.


Can you point in general direction to where?


CreateShortDescription() in the Node class, but looking at your code example, you already found that one happy.


That is remarkable. The code is almost identical. The code I posted was not from there!


Well, then we probably used the same online example happy
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Yet Another Forum.net version 1.9.0 running under Cuyahoga.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.