来自两个ContentPages的具有特殊字符的相同MetaDescription在Google中的显示方式不同

时间:2012-12-28 10:23:19

标签: c# asp.net encoding meta-tags

我的ASP.Net 4.5 Web应用程序项目,Metadescriptions和Google遇到了编码问题。

我有两个页面使用相同的MasterPage:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta http-equiv="Content-Language" content="de" />
    <meta name="description" content="...für..." />
...

我有两个ContentPages A和B都使用此MasterPage而不更改MetaDescription 但是,在Google中,他们不会显示相同的MetaDescription(在Google中的每个搜索结果中都会显示一些文本,对于这两个页面,这是他们的MetaDescription)。

ContentPage A 显示“für”而不是“für”
ContentPage B 正确显示“für”

我似乎无法找到这些页面之间的巨大差异。它们从数据库中呈现不同的内容。我在大约10%的页面上都有这个问题。我发现的一个共同点是,每个显示来自我的数据库的新闻的页面都显示了元描述的错误编码。包含不同内容的其他页面也可能有也可能没有这个问题 我猜谷歌“错误地”假定整个页面的另一个借口?

如何正确追踪?

来自内容页面的两个标题在Chrome中的“查看来源”窗口中看起来相同:

第A页

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="de" />
<meta name="description" content="...für..." />

第B页

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="de" />
<meta name="description" content="...für..." />

如何摆脱编码问题并在Google搜索中正确显​​示元描述?大多数其他内容页面在Google搜索中没有任何编码问题。

1 个答案:

答案 0 :(得分:0)

这是远景,但考虑到你正在服务xhtml,尝试下面的一个或组合

  1. 从html标记
  2. 中删除xml:lang
  3. 尝试xml:lang="de"
  4. 尝试添加xml声明<?xml version="1.0" encoding="iso-8859-1"?>