This question is about Blogger Template manipulation. People developing/changing or manipulating Blogger templates in any way know its syntax hence can provide some input.
我写了development blog在 Blogger 上,我更改了我的博客模板,因此帖子显示 HTML
head
标题不同(帖子名称在前)与默认(博客名称在前)。但。因为我格式化我的内联编程代码字类似于 Stackoverflow(灰色背景等宽字体)并且在我在博客文章标题中使用它们中的任何一个时做同样的事情......我将这些代码字附在
<code/>
中元素,然后我为此特定元素设置了 CSS,以将其添加为灰色背景并在其上设置等宽字体。此格式适用于博客文章标题及其内容。但我遇到的问题是这些
<code/>
我使用的标签也显示在 HTML head
中title
(显示在浏览器窗口标题中)。更重要的是,这些显示在 web search results 中。以及。那就更烦了。默认模板使用
<data:blog.pageTitle/>
在 title
元素,它去掉任何标签,但将所有标题显示为博客名称:博客文章标题(谷歌搜索结果毫无意义,因为博客文章标题被截断了)。这就是我使用 <data:blog.pageName/>
的原因而是在头部只显示博客文章标题,但它仍然包含所有标签,我应该以某种方式将它们删除。查询 this blog post例子。加载它,然后查看仍然显示标签的浏览器窗口标题栏。我要他们走了。
将帖子添加到
head
时,如何从帖子标题中删除标签元素?
最佳答案
更新
好的,到目前为止,这是我的工作:
<data:blog.pageTitle/>
如题; <b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
<b:widget id='Header1' locked='true' title=' (Intestazione)' type='Header'/>
</b:section>
使用您的自定义标题
<div class="header section" id="header">
<div class="widget Header" id="Header1">
<div id="header-inner">
<div class="titlewrapper">
<h1 class="title">
<a href="http://aseptik.blogspot.com/">aSeptik Site</a></h1>
</div>
<div class="descriptionwrapper">
<p class="description">
<span>
</span>
</p>
</div>
</div>
</div>
</div>
<title>
将导致:jQuery <em>"scroll into view"</em> plugin (with an additional <code>":scrollable"</code> selector filter)
到
: jQuery "scroll into view" plugin (with an additional ":scrollable" selector filter)
希望这有助于,演示 http://aseptik.blogspot.com/2011/02/jquery-scroll-into-view-plugin-with.html
尝试在您的
<body>
中使用一点 javascript像这样<script type='text/javascript'>
document.title = document.title.replace(/(<([^>]+)>)/ig,'');
</script>
</body>
按原样复制和过去不转换实体,
although, i'm not sure this is the right solution for you since spiders usually avoid js execution, and i don't know how "html tags in the title" affects the search results.
关于title - 如何操作 Blogger 模板中的字符串。不可能的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4827421/