<标题>从 MasterPage 生成时,标记被拆分为多行标题>
我在 VS 2008 (C#) 中创建了一个使用母版页的网站。
在基于母版页的 ASPX 页面中,我使用 @ PAGE 标题指令来设置生成的 HTML 页面的标题。
当我在开发系统上运行该页面时,标题在浏览器中正确显示。然而,当我在浏览器中查看源代码时,标签被分成 3 行。
<head><title>
My Page Title
</title>
...other meta tags...
</head>
这对我来说看起来很奇怪。我是否做错了什么导致了这种行为?搜索引擎会看不起这种带有换行符的语法吗?
我期待这样的输出:
<head>
<title>My Page Title</title>
...other meta tags...
</head>
I have created a website in VS 2008 (C#) that is using masterpages.
In the ASPX pages that are based off the masterpage I'm using the @ PAGE title directive to set the title of the genereated HTML page.
When I run the page on my development system the title displays correctly i nthe browser. However when I view the source code in the browser the tag is being broken into 3 lines.
<head><title>
My Page Title
</title>
...other meta tags...
</head>
That looks very strage to me. Is there something that I am doing wrong to cause the type of behavior? Will search engines look down on this syntax with the line breaks?
I'm expecting output like this:
<head>
<title>My Page Title</title>
...other meta tags...
</head>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以前从未见过这种情况发生,并且在过去的一年中我使用过母版页和页面标题几次。
从 SEO 的角度来看,搜索引擎会忽略标题中的换行符,只查看 open 和 close 语句之间的实际字符。
I've never seen that happen before, and I've used MasterPages and Page Titles a few times in the past year.
From an SEO perspective, search engines would ignore the line break in the title and only look at the actual characters between the open and close statements.
这不会有太大区别。不管怎样,你都应该没问题,而且搜索引擎足够聪明,不会仅仅因为换行或返回而感到困惑。只要 HTML 没有格式错误,就应该没问题。
This won't make much of a difference. You should be fine either way, and search engines are smart enough to not get confused only a new line or return. Just as long as the HTML isn't malformed, you should be alright.