Ajax加载的元标记

Ajax加载的元标记

本文介绍了Ajax加载的元标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我对ajax的奇迹还很陌生.我一直在玩东西等等.

Im quite new to the wonders of ajax. I've been playing around with stuff etc.

为了详细说明,我有一个简单的5页网站,除内容外,每个页面都是相同的.相当普通的场景.因此,我所做的只是使用ajax为每个页面添加内容.这意味着在我的网站文件夹中,我有一个.php文件.(有点像母版页.),所有内容更改都只在较小的.html文件中加载.

To elaborate, i have a simple 5 page website where every page is the same except for the content. Pretty generic scenario. So what i've done, is just added the content for each page using ajax. Meaning that in my website folder, i have ONE .php file. (kind of like a master page.) and all the content changes are just in smaller .html files that are loaded.

对于徐,每个页面都需要元标记等...

For Seo, Each page needs meta tags etc...

但是,如果我只有一个页面,其中的内容只是更改,那么显然每个页面的meta标签都是相同的.因为加载内容时元标记不会更改.

But if i have ONE page where just the content changes, obviously the meta tags for every page will be the same. Because the meta tags arent changing when the content is loaded.

所以我的问题是...如果我也有相应的元标记文件,并在加载内容的同时将它们加载到头部.然后,元标记将发生变化,这是即时消息.

So my question is... If I also have corresponding meta tag files and load them into the head at the same time as loading the content. The meta tags will then Change, Which is what im after.

但是!!!因为它全部在一页中,并且meta标签将从单独的文件中加载,所以搜索引擎仍然可以...进行某种工作.像,谷歌会知道该网站是一页,但元标记是不同的吗?

BUT!!! because its all in one page and the meta tags will be loaded from separate file, will search engines still be able to... kind of work. Like, will google know that the website is one page but the meta tags are different?

我想不出更好的方法来解释这一点.但是任何建议都将是有用的:),如果没有,那么……我是否必须将网站恢复为每页一个文件等的无聊方法.

I cant think of a better way to explain this. But any advice would be useful:) and if not... Will i have to revert my site back to the boring method of one file per page etc.

干杯:)

x

推荐答案

由于meta标签是dom的一部分,因此您可以更改值.如果您尝试将其更改为SEO/搜索引擎,我认为这不会有任何区别,因为蜘蛛程序(据我所知)不会执行javascript.

As the meta tags are part of the dom you would be able to change the values.If you are trying to change them for SEO/Search engines I don't think it will make any difference as the spider (as far as I know) doesn't execute javascript.

在禁用javascript时,最好确保站点能够正常运行.称为不引人注目的JavaScript"或优美的降级效果".

You are best off making sure the site functions as you wish when javascript is disabled. Refered to as 'Unobtrusive JavaScript' or 'Graceful Degredation'.

这篇关于Ajax加载的元标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 00:45