Canonical Link Does Not Make Anything - head

Guys I have two different link but same website.
one of them is: https://example.com/
other is: https://www.example.com/
I am doing this process in a nodejs and pug. So I have a layout file which I have added my canonical link in order to effect every page of my website.
My canonical link (in Pug syntax):
link(rel="canonical", href="https://www.example.com/")
But I have added this link to my head in my layout.pug
Why it is not redirecting to canonical url?

The "canonical" link type does not redirect browsers to a different URL. Its purpose is to tell search engine spiders which variant of a page to index.

Related

Recursive wget: alter links

I am trying to optimize my AJAX fragment links for Google crawler (which substitudes "#!..." links with "?_escaped_fragment_=..." as described here). I want to check if the entire site is accessible via _escaped_fragment_ links I have implemented.
I am curious if I can use wget recursive site download to this end and make it substitude "#!" links with "_escaped_fragment_", so that wget sees
abc.com?_escaped_fragment=arg=value
instead of
abc.com#!arg=value
No you can't strings after # is not sending to server... they are for JavaScript routing.

How do I make my hosting detect _escaped_fragment_ and fetch the corresponding HTML?

I have an AJAX site and I'm using hashbangs (#!) in my urls with the intention of then providing the correct HTML versions when google bots replace the #! with ?_escaped_fragment_.
How do I go about routing/proxying/redirecting the url with _escaped_fragment_ to the corresponding HTML pages? I can't find documentation on this part of the process specifically, and my first thought was that I should be using a 301 or 302 redirect, but I was told that wasn't the case, albeit not given any more info.
You can't use htaccess or redirects at all. Everything after the # in the URL isn't even sent to the server. The URL fragment is entirely client side. You'll need to use some kind of javascript solution to look at the fragment, and make whatever appropriate AJAX call to the server and load the content you get back.

Joomla: Is there a querystring parameter that can remove a pages theme?

We've got a joomla website and are now in the process of developing a sencha-touch application to complement it.
Since our website is in joomla, I don't want to have to write any PHP to extract page data separate from the main site.
Is there any type of querystring parameter that can disable the theme?
IE:
http://example.com/about-us?show-theme=false
If this is not possible, is there any other option to achieve similar results?
index2.php is depreciated and is no longer supported in new versions of Joomla. What you are looking for is ?tmpl=component. You can add that to any Joomla URL and it will only display what you have coded in the /templates/YOUR TEMPLATE/component.php file. The default loads just the component output, but you can customize it to do what ever you want.
Do I get your question right: you want to extract the content from the page, without menu and so on? 2 possibilities, then:
Extract it from the concerning RSS feed (of the front page, of a category ... if you need more options you can install an component such as Total RSS
Use index2.php: example site (This doesn't seem to work if you use URL Rewriting as in your example URL.)
you can add format=raw in the URL. This will only output the content of the component and not the template.
This is used to show printable pages.
You may have to create a view.raw.php file along with the view.html.php

Redirect AJAX page requests to canonical links with .htaccess

I'm coding a site that makes heavy use of AJAX to load pages for users with JavaScript, but I also want it to be friendly for users with JavaScript disabled or unavailable. I've covered all the basics; for example, all my links point to canonical links, and JavaScript loads them via AJAX. My "about" page, therefore, is located at /about/, but will load on the main page and will, once finished, utilize hash/hashbang links to enable back-button functionality.
Here's the problem I have: while a hash/hashbang link will be able to be used to link to a specific page via AJAX for users with JavaScript, if a user with JavaScript attempts to link someone without it to the page, the page cannot be loaded for that person using AJAX.
As such, I'd like to be able, if possible, to use .htaccess to redirect hash/hashbang-specified pages to the canonical link. In other words, the exact opposite of what this contributer was trying to achieve.
http://example.com/#!about --> http://example.com/about/
Is it possible with .htaccess, or otherwise without JavaScript? If so, how?
Thanks!
I don't think it's possible to do this on server side. Because the part of the url after # is not included in the request sent to the server.
I might be a bit late to the party on this one, but i'm looking into this too. Since your url already contains the #!, as opposed to #, you can actually do this. Google will fetch
http://example.com/#!about
as
http://example.com?_escaped_fragment_about
Therefore, if you use a redirect 301 on that, and use javascript to redirect the user only version of the page, you have practically reached your desired result.
I realise you asked for a no-javascript solution, but i figure that was for reasons of SEO. For more information, please see this page by google.
EDIT:
<meta http-equiv="refresh" content="5; url=http://example.com/">
Some more on meta refresh here.
It:
1) Does not require javascript!
-
2) Can be Seo friendly!
-
3) Works with bookmarks and history (etc.)
I hope this helps!

Facebook like or share with dynamic document title

I found this problem all over the net but no answer yet, so maybe here someone solved it ...?
I built a page relying heavily on jquery.address. It's got one index page and the rest loads dynamically via Ajax following Google's /#!/ scheme for crawlable pages. Now I want to add Facebooks Like or share button but I can't get it to grab the actual page title or url.
Whatever I do, it always falls back to title and url of the index page. It tried:
(obviously) changing title an openGraph meta on load of the new parts.
"linking" the crawler page (?_escaped_fragmet_=xyx) but specifying the #! page in meta
"sharing" with a given title and url.
I never get anything but a link to the index page or a blank "share" to the right url with title and thumbnail ignored.
Has anyone got a similar setup working?
Thanks for any hints,
thomas
Facebook is actually using #! now and it works! If you build your site so that http://site.de/?_escaped_fragment=something is identical to http://site.de/#!/something all you have to do is "share" the #! url and it'll display the info from the escaped fragment page.
Use this URL to check: http://developers.facebook.com/tools/debug
But: A much cleaner solution to the problem can be found here: http://github.com/browserstate/history.js/wiki/Intelligent-State-Handling
My guess would be that Facebook's crawler doesn't run Javascript and will always display whatever's actually in the page it gets from the server.
Facebook share has a BRUTAL cache, last time I checked it was impossible to change the title / description data once it was scraped :(
The issue I had was the og:url and the actual url of the page did not match. I also read a number of comments about the og data being just after the title element, but I don't think that solved anything.
With regard to issues of caching, it is true that Facebook's caching is "brutal", but it does not cache anything for the lint tool: http://developers.facebook.com/tools/debug.
I use no-hash-bang urls when sharing links. I process the hard links and redirect them to a hash bang client side using javascript. That way if a crawler goes to the hard linked page it will display the information just as it would if javascript were enabled.
Compare:
http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Flikeapage.com%2F%23!%2FChristmas%2Fvs%2FBacon
and
http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Flikeapage.com%2FChristmas%2Fvs%2FBacon
Hope this helps.

Resources