SEO and anchor link "onclick" - onclick

I'm working on a page where links are added with JavaScript. This is according to my knowledge not optimal when it comes to SEO.
Example added by DOM-manipulation/jQuery:
Go To Page
So I have added a correct href attribute and creates the tag server side, like this:
Go To Page
Will google and other search engines accept the href even though the navigation is done by the JavaScript function, or will anchor tag be "down-prioritized" due to containing a link that cant be accessed? The link itself will lead to the same page as the JavaScript event. However it is not actually used in this case.

Crawlers will see the href links and try to use them. Google crawlers are capable of using javascript to follow links as per the blog here with few gotchas. http://www.searchenginepeople.com/blog/onclick.html. If you want your link to crawled, then there are other alternatives as google will follow text urls on page source.

Related

How to get the XPATH or CSS selector from dynamically loaded website to follow links?

This is a dynamically-loaded website https://www.gelbeseiten.de/suche/hotels/n%c3%bcrnberg.
I'm trying to follow every link from the results. I found //article[#class='mod mod-Treffer']/a to follow the search result links. But the problem is this XPATH works only for a couple of links. For the rest of the others, I don't find any Selector. Because the other are using probably JS to make this action. I'm not familiar with this kind of dynamic website. So, I don't know how to get the selector from this kind of website. Any suggestions will be highly appreciated.
I will post this as an answer, without actually giving you the code, as it might help you more in the long term.
First, load that page in browser with javascript disabled (there are ways with disabling js in browser directly, or use an extension like ublock origin, etc - look it up).
You will notice that only the first 2 hotels are fully loading - the rest are being loaded dynamically by javascript (which in this case is disabled). There are 13 hits for //article[#class='mod mod-Treffer']/a selector, while there are more hotels on that page.
However, each hotel is wrapped in an <article> tag, and that tag has data-realid="[...]" attribute. The url for each hotel would be https://www.gelbeseiten.de/gsbiz/{data-realid}.
This is how you can get all those hotels' profile links.

Google Analytics Implementation

I'm looking at implementing Google Analytics and was wondering:
Can the tracking code be put in an external file, with the rest of my js then minified? If not, can the js be minified to one line then used on my page?
Or does the code have to go in my ? In some examples I've seen it after the body tag at the bottom of the page, why is this?
yes you can put it in your external .js file.
No It doesn't matter really where in the page you place it. Some people put it in the Head tag others in the footer. Personally I place it in the head tag that way I can add event tracking and custom dimensions though out the page as its built. But its really personal preference where you place it.

how can i remove the social bookmark plugin using html or javascript

sory guys, click the first link you will see the image i been mark by red, after you click the second link, you will see the arrow.
1) http://s261.beta.photobucket.com/user/minaekoz/media/satu.png.html
2) http://s261.beta.photobucket.com/user/minaekoz/media/satua.png.html
Question :
That is social bookmarking site i use to promote my blog but i want to remove the plugin after somebody click that link in the first image.
how can i remove that plugin in the second image after user click the link at the first image?
*sory if my english so bad
I'm not sure how your page is embedded, I guess it's done using frames or an iframe? This would be important to know, but you'll most likely be able to use some javascript code like this (called in some element's onload event (e.g. <body>):
if (window.top != window.self)
window.top.location.replace(window.self.location.href);
I think you can add it through using a custom BlogSpot template or maybe with some of the widgets as well.
Probably you can't. That social bookmarking site will probably open your website in an IFRAME, and therefore, clicks in your page cause IFRAME navigation, and not browser navigation.
Since your site, and the IFRAME site are different, the javascript in your site cannot access the DOM (Document Object Model) in the other site because SOP (Same Origin Policy).
You can disallow that your website run in IFRAMEs by using the X-Frame-Options http header though, but I would leave it like that.
Cheers.

Site Map - Accesibility question regarding use of overlay?

Quick question - Does it matter (accessibility wise) if a site map is placed in a hidden div in each page and displayed in overlay on request!?
Just because this would be a best quick fit solution regarding a site I need to alter!
Cheers
Paul
I think the best approach would be to have your sitemap on a separate page with it's own URL. This would then allow you to:
Provide a link to the sitemap e.g. on your 404 page to help users find what they are looking for
Add a <link> tag to the <head> of each page specifying the sitemap as the index of the site e.g. go to http://www.apple.com/uk/ and view source
If your sitemap is only included in a hidden tag shown via a lightbox overlay then in terms of accessibility you'd have to think of how users with JavaScript and / or CSS disabled would access it, how this would affect users using screen readers, etc.
Plus having your sitemap available on its own URL would help search engine spiders when crawling your site.
You could always add the sitemap lightbox overlay effect as a progressive enhancement though for users whose browsers can view it this way, but as you mentioned you were after a quick solution this might not be that feasible.
Its not required to place in the hidden div for the sitemap link.

Can google see the contents of an iframe when spidering?

I've looked this up and have not found consistent answers. I want to embed a google doc in my page (when you publish your google doc it gives you an iframe). Will search engines like google be able to read the contents of the document (just text, but may have important keywords)? Or will it act as if the page was empty?
If it cannot index the text then is there any way to have the embed in some sort of server side include so that it appears to be hard-coded into the html to spiders?
No, they will not read it and assosiate the content to your site. They will eventually crawl it sometime but it will not be associated as "your" content.
Only way to do it, is to write server side code that scrapes the content and outputs it inside your page.
Right now, the page looks empty to the search engines.
I am not so sure that they can't since you can start seeing iframe content being rendered in the site previews under Google Search i.e. any facebook page tab application can be seen now and they all work through iframes

Resources