iframe 的 SEO 友好替代品?
我有一些内容想与其他网站分享。
目前我通过 iframe 执行此操作:
<iframe width=“540”; height=“700” frameborder=“0” src=“http://www.energiekostencalculator.nl/forms/frame_tabs.php?first=yes&product=1&links=1&css=http://www.energiekostencalculator.nl/forms/susteen.css”></iframe>
这有两个问题。
- 它对 SEO 不友好。 iframe 内容上的链接不算作入站链接,因为它们的页面托管在我的服务器上。
- (无论如何在我的服务器上)不可能将外部 css 样式表链接到 iframe 的内容。目的是允许其他网站轻松地将其样式表链接到我的内容。
谁有办法解决这些问题? 也许使用jquery(见下文),但是我不确定谷歌会解析它并“查看”链接......
<html>
<head>
<script src="/js/jquery.js" type="text/javascript">
</head>
<body>
<div id='include-from-outside'></div>
<script type='text/javascript'>
$('#include-from-outside').load('http://example.com/included.html');
</script>
</body>
</html>
I have some content I would like to share with other websites.
Currently I do this via an iframe:
<iframe width=“540”; height=“700” frameborder=“0” src=“http://www.energiekostencalculator.nl/forms/frame_tabs.php?first=yes&product=1&links=1&css=http://www.energiekostencalculator.nl/forms/susteen.css”></iframe>
This has two problems.
- It is not SEO friendly. The links on the content of the iframes do not count as inbound links since they page is hosted on my server.
- It is (on my server anyway) not possible to link outside css stylesheets to the content of the iframe. The objective is to allow other websites to easily link their stylesheet to my content.
Who has the solution to these issues?
Perhaps using jquery (see below), however I'm not sure Google would parse it and "see" the links...
<html>
<head>
<script src="/js/jquery.js" type="text/javascript">
</head>
<body>
<div id='include-from-outside'></div>
<script type='text/javascript'>
$('#include-from-outside').load('http://example.com/included.html');
</script>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
看看 TripAdvisor 是如何做到的 - 一个静态链接,然后在页面加载后用 JavaScript 替换它。
Have a look at how TripAdvisor does it - a static link and then javascript to replace it once the page has loaded.
iframe
有一些更好的替代方案,但实际上取决于“其他网站”通过创建 HTML 快照使其可抓取,使 AJAX 应用程序可爬行。至于您的代码示例,由于 同源策略。
其他 iframe 替代方案可能是大多数小部件使用的脚本标记,您可以在其中告诉内容用户将小部件(脚本标记)嵌入到将保存内容的父 div 中,并且当您的脚本加载时,它将自动填充其父元素,与内容。
There are some better alternatives to
iframe
but its really up to the "other websites" to make it crawlable by creating HTML snapshots, Making AJAX Applications Crawlable.As for your code example, Its not possible to load content from external domains, due to the Same origin policy.
Other iframe alternatives maybe a script tag, which most widgets use, where you tell your content users to embed your widget (script tag) into a parent div which will hold the content, and when your script loads it will automatically fill its parent element, with content.
有一种更“高级”的方法可以做到这一点,但它可能受到某些共享服务器的限制。我认为任何其他方式都无法通过 AJAX 或 iFrame 解决您的问题。由于它看起来像是所有 html 和 javascript,除了在显示页面之前通过 php 解析的内容之外,您应该能够通过 fsocketopen 然后对来自其他服务器的内容执行任何操作。您可以预先生成可供您的客户或客户在其服务器上使用的代码。
There is a more "advanced" way of doing this but it might be limited by certain shared servers. Any other way I don't think you could solve your issues either by AJAX or iFrames. Since it looks like it's all html and javascript other than what gets parsed via php prior to the displaying of the page you should be able to load the actual contents of the site directly from server to server via fsocketopen and then do anything with that content from the other server. You could pregenerate code that could be used by your clients or customers on their servers.
没有上下文的链接集合不会对 SEO 友好,就这样。在网络上传播一段只有一些链接的 HTML 只会破坏嵌入它们的人的公关。如果您想要 SEO 优势,那么您需要包含每个链接网站上的链接的独特(相关!)内容(否则欢迎重复内容处罚)。
鉴于此,您不妨继续使用 iframe(假设向其他网站的访问者显示链接有好处)。
A collection of links with no context isn't going to be SEO friendly, period. Spreading a chunk of HTML that just has some links in it around the web is just going to trash the PR of people who embed them. If you want SEO benefits, then you need unique (relevant!) content containing the links on each site linking in (otherwise welcome to duplicate content penalties).
Given that, you might as well just continue to use an iframe (assuming there is a benefit to showing the links to visitors to the other sites).
我认为您可能有一个带有
overflow: auto;
的DIV
(并指定尺寸)。然后 HTML 可以位于 DIV 内部(也是页面的一部分),而不是位于单独的文件中。I think you could probably have a
DIV
withoverflow: auto;
(and specify dimensions). Then the HTML can be inside the DIV (and so part of the page) rather than in a separate file.也许你应该创建一个 API。这肯定会解决问题#2——允许发布商以他们喜欢的任何方式设计您的内容。
关于问题#1 - SEO - 我不确定。不懂网站的语言,但据我了解,您允许人们将某种有用的计算器嵌入到他们自己的页面中,而他们页面的内容通常会保持唯一,因此这可能对 SEO 有好处,也可能没有好处,我还想知道是否有 SEO 专家读过这篇文章。
Maybe you should create an API. This will definitely solve issue #2 - allowing publishers to style up your content any way they like.
And about issue #1 - SEO - I'm not sure. Don't understand the language of the site, but to my understanding you allow people to embed some kind of useful calculator to their own pages, while the content of their pages would generally stay unique, so this may or may not be SEO benefitial, I'd also like to know if any SEO experts read this.