SEO with Single Page Website
I know there are MANY questions that address SEO with single page websites/applications. However, I have a very specific question that I haven't seen directly asked.
I have a very simple static website with 4 pages. This is not a javascript intensive site or a single page application. The content and SEO is what really matters. It's so simple that I would like to load all of the website's content (all 4 pages) in one page, so that when the user clicks a link to go to another "page" there is no http request, ajax, or page loading. It just hides the current page's content, and show's the next page's content that is already loaded, and uses pushState to handle the url and history.
What this means is that when the search engine crawls www.mysite.com/about, at the top will be the content for the about page clearly visible, but somewhere on the page I would have to store the html for the other 3 pages without those 3 pages being indexed as part of the about page. So on any given page, I would have 3 other page's content somewhere, hidden.
A) Is this possible? B) Is this safe to do without search engines interpreting it as me trying to be misleading about the content i'm showing.
Edit: This questions is about single page websites and SEO, which both specifically require html, javascript, pushstate, and single page application methods
I don't think that is possible in the way you explained. It requires Ajax :
• 4 HTML pages (index.html, about.html, and so on)
• Ajax only load the content of each page, on demand, and you can handle URL with pushstate, so you can have a navigation that doesn't reload the browser
• Google can crawl each HTML page without JS consideration
Why your solution won't work ?
• Google will crawl the whole index page (regardless of which content should be displayed)
Note that I'm not SEO expert, just giving my point of view (technical :) ).
Without AJAX :
• Implement your content as JS variables or objects in an external JS file :
about = {
title:"My page title",
content:"My page content",
url:"/about/"
};
• make your js file hidden from search engines :
User-agent: *
Disallow: /js/main.js
• make the calls to implement the new content whatever the page you click on :
$('nav a').click(function(){
var href = $(this).attr('href'); // be sure the href of the a element has the same name as the JS object
$('h1.title').text(href.title);
$('p.content').text(href.content);
history.replaceState(page: href.url,href.title,href.url);
});
Not sure the JS part will work as I didn't test it.
链接地址: http://www.djcxy.com/p/62520.html下一篇: SEO与单页网站