Absolute Path vs. Relative Path - put relative contents link in post - hyperlink

When I write a post, I want to link to some other related posts in the content.
I have two option for link:
1. "http://www.example.com/related-post-slug"
2. "/related-post-slug"
Is there any difference between these in this situation? for SEO or something else...?

Many reasons why you wouldn't want to use absolute path but perhaps some benefit from an SEO perspective. http://www.dirigodev.com/blog/seo-web-best-practices/relative-vs-absolute-urls-seo/

Related

Get url of Orchard default pages

I am using orchard 1.9 and I am building a service in which I need to get current URL.
I have OrchardServices and from that I can get the URL like so:
_orchardServices.WorkContext.HttpContext.Request.Url.AbsolutePath;
This works like a charm for pages/routes that I have created but when I go to the Login or register page (/Users/Account/LogOn) the absolute URL is / and I can't find anyway to get the URL or at least any indication that I am in the LogOn or Register.
Anyone knows how I could get the full url?
If I understand what your're asking, you could use the ItemAdminLink from the ContentItemExtension class.
You will need to add references to Orchard.ContentManagement, Orchard.Mvc.Html and Orchard.Utility.Extensions, but then you will have access to the #Html and #Url helpers.
From there you will have the ability to get the link to the item using:
#Html.ItemDisplayLink((ContentItem)Model.ContentItem)
The link to the item with the Url as the title using: #Url.ItemDisplayUrl((ContentItem)Model.ContentItem)
And you should get the same for the admin area by using these:
#Html.ItemAdminLink((ContentItem)Model.ContentItem)
#Url.ItemAdminUrl((ContentItem)Model.ContentItem)
They will give you relative paths, e.g. '/blog/blog-post-1', but it sounds like you've already got a partial solution for that sorted, so it would be a matter of combining the two.
Although I'm sure there are (much) better ways of doing it, you could get the absolute URL using:
String.Format("{0}{1}", WorkContext.CurrentSite.BaseUrl, yourRelativeURL);
...but if anyone has a more elegent way of doing it then post a comment below.
Hope that helps someone.

How to make href's work as expected

I have two questions here, that I thought there were already asked, but I could not find anything related.
Let's suppose I have the following URL:
http://www.domain.com/folder/page
And I have an anchor like this:
Page2
First:
Of course when it is clicked, it will navigate to
http://www.domain.com/folder/page2
But if the user has this URL:
http://www.domain.com/folder/page/ <-- Note the last slash
Then the anchor will navigate to:
http://www.domain.com/folder/page/page2
The first question is:
How can I avoid this?
And the second question would be:
How to always do this?
I mean that even if the url ends with a slash or not, navigate to:
http://www.domain.com/folder/page/page2
I know I can do this with javascript, but the idea is to keep using the href without using javascript in every case this happens. I also know I can use relative urls starting with / to referrer the root, but I can't in this case because the url has some IDs in the middle that may change.
Your basic problem is that you have two URLs that resolve to the same resource.
Pick one of them to be canonical and redirect from the other one two it using HTTP.
Failing that, use root relative URIs:
href="/folder/page2"

Does the order of querystring in url affects seo (duplicate content)?

Does the order of querystring affects seo (duplicate content)?
is a page index.php?a=1&b=2 considered a duplicate of index.php?b=2&a=1
If you serve the same content on the pages then it would be duplicate content. You can set canonical tags to point to the preferred version of the page for indexing :http://googlewebmastercentral.blogspot.co.uk/2009/02/specify-your-canonical.html
Of course, it does not make a difference to SEO.
Order for URL query parameters does not matter and all URL libraries that I know do not order query params in no sense, therefore it would not make sense for SEO engines to differentiate between cases ?a=1&b=2
On the other hand, for completeness, the order of URL path segments matters and these would have a different effect on SEO:
/shoes/Abibas vs Abibas/shoes

how to remove sitecore folder name in the url?

I created a sitecore year/month/day folder structure in the content tree, when i view each article under the folder node, the url could be http://local/landing/year/month/day/article1.aspx, how could I make the url like this: http://local/landing/article1.aspx?
just remove the year/month/day structure in the url.
Is there some function in sitecore like remove or hide special templates in the frontend url ?
Any help , Thanks .
You can do it in 2 ways:
Use IIS 7 Url rewrite module to change the url. This way the url will be rewritten before it gets to sitecore and you don't need to change any code. You can find more info at the iis website
You can create a custom Item resolver and add it to the RequestBegin sitecore pipeline. Alex Shyba wrote about it here.
It sounds like you may have thousands of these items, but even so, you may want to use the built in functionality of Sitecore and consider creating aliases for each of these items. Programmatically creating an the alias on an ItemSaved event or ItemCreated is probably easiest.
As #marto and #seth have said, you can use URL rewriting or aliases to solve this.
There is, however, a drawback to doing this, irrespective of how you choose to do it.
If you have very many items (your structure makes it sound like you may do) then either method will require that the URL is unique. Removing the date structure from the URL means that all items in your landing section will require unique URLs (whether inherited from their item names or by some other means). This can impact on SEO for your site, as authors may have difficulty finding an unused name that is also human readable and good for SEO. It's unlikely you want to use ugly GUIDs in your URLs.
2 options
Change Bucket configuration and the set the required folder structure, bucket configuration can be found in Sitecore.Buckets.config file
Extend GetFromRouteValue Item Resolver and overwrite the ResolveItem() method to get the bucket item.
The default GetFromRouteValue class reference can be found in Sitecore.MVC.config file and replace this with your own customized implementation.
We have implemented with customized routing and getting the exact item if the route path matches.
Thanks,
Jisha

SEO urls in rails: .html ending vs. none. What's best?

I'm thinking about a good SEO Url strategy for a blog application. I'm not sure - and maybe it's just the same - but what is better? With or without .html
/blog/entry_permalink_name.hml
VS
/blog/entry_permalink_name
What do you think?
To answer directly you question, without the HTML is better SEO-wise. The search engines take keywords from the url into account. Now the more words or characters there are in the url the weaker the power of a given keyword.
It follows logically that there is no SEO advantage in adding '.html' at the end of the url.
Similarly removing the blog bit would enhance the power of the keywords in the title but if you want to use 'blog' as a valuable keyword, leave it.
Keep in mind that the url is just one of many factors of optimization of a page for SEO, and not the most powerful at that. The common thinking here is that none of these optimization tricks make a substantial difference by themselves but they do cumulatively.
I would suggest removing /blog/ from the url and making it as follows:
/entry-permallink-name
word 'blog' introduces extra irrelevant term to your URL
.html would be mostlikely ignored by search engines, but it's absence makes it a bit more user-friendly, so do dashes instead of underscores.
I disagree about not having the blog entry in there. I don't think 'blog' is an irrelevant term since you are writing a 'blog' application and good has a search 'blog' section.
As for your question, look in your address bar when you view this question. Stack overflow seems like a good site to emulate.
I do agree with xelurg about the dashes instead of underscores.
I would keep the unique id in the name just like stackoverflow. It's a lot simpler that way.

Resources