C# Class Decision.Common.Helpers.FriendlyUrlHelper

Helps convert string title text to URL friendly string's that can safely be displayed in a URL.
ファイルを表示 Open project: rabbal/Decision

Public Methods

Method Description
GetFriendlyTitle ( string title, bool remapToAscii = false, int maxlength = 80 ) : string

Converts the specified title so that it is more human and search engine readable e.g. http://example.com/product/123/this-is-the-seo-and-human-friendly-product-title. Note that the ID of the product is still included in the URL, to avoid having to deal with two titles with the same name. Search Engine Optimization (SEO) friendly URL's gives your site a boost in search rankings by including keywords in your URL's. They are also easier to read by users and can give them an indication of what they are clicking on when they look at a URL. Refer to the code example below to see how this helper can be used. Go to definition on this method to see a code example. To learn more about friendly URL's see http://moz.com/blog/11-best-practices-for-urls. To learn more about how this was implemented see http://stackoverflow.com/questions/25259/how-does-stack-overflow-generate-its-seo-friendly-urls/25486#25486

Private Methods

Method Description
RemapInternationalCharToAscii ( char character ) : string

Remaps the international character to their equivalent ASCII characters. See http://meta.stackexchange.com/questions/7435/non-us-ascii-characters-dropped-from-full-profile-url/7696#7696

Method Details

GetFriendlyTitle() public static method

Converts the specified title so that it is more human and search engine readable e.g. http://example.com/product/123/this-is-the-seo-and-human-friendly-product-title. Note that the ID of the product is still included in the URL, to avoid having to deal with two titles with the same name. Search Engine Optimization (SEO) friendly URL's gives your site a boost in search rankings by including keywords in your URL's. They are also easier to read by users and can give them an indication of what they are clicking on when they look at a URL. Refer to the code example below to see how this helper can be used. Go to definition on this method to see a code example. To learn more about friendly URL's see http://moz.com/blog/11-best-practices-for-urls. To learn more about how this was implemented see http://stackoverflow.com/questions/25259/how-does-stack-overflow-generate-its-seo-friendly-urls/25486#25486
public static GetFriendlyTitle ( string title, bool remapToAscii = false, int maxlength = 80 ) : string
title string The title of the URL.
remapToAscii bool if set to true, remaps special UTF8 characters like 'è' to their ASCII /// equivalent 'e'. All modern browsers except Internet Explorer display the 'è' correctly. Older browsers and /// Internet Explorer percent encode these international characters so they are displayed as'%C3%A8'. What you /// set this to depends on whether your target users are English speakers or not.
maxlength int The maximum allowed length of the title.
return string