blogger - blogspot 数据 :navMessage

标签 blogger blogspot

我成功地通过 javascript 更改了这些导航消息文本:

<div class='status-msg-body'
           <script
     var str=&#39;<data:navMessage/&#39;;

     str2=str.replace(&quot;Visualizzazione dei post in ordine di pertinenza per la query&quot;,&quot;Articoli
 contenenti:&quot;).replace(&quot;Visualizzazione post con
 etichetta&quot;,&quot;Articoli appartenenti alla
 categoria:&quot;).replace(&quot;Nessun post corrispondente alla
 query&quot;,&quot;Nessun articolo contiene&quot;);


     document.write(str2);
     </script
         </div

但是如果我搜索带有撇号的短语,例如。狗的,导航消息是空白的 有办法解决这个问题吗? 谢谢

最佳答案

Javascript 不是必需的。编辑此消息的更好方法是替换每个 <data:navMessage/>与:

<b:if cond='data:numPosts == 0'>
    <b:if cond='data:blog.searchLabel'>
        No posts for label: <b expr:data-search="data:blog.searchLabel"/>.
    <b:elseif cond='data:blog.searchQuery'/>
        No posts for query: <b expr:data-search="data:blog.searchQuery"/>.
    <b:elseif cond='data:blog.pageType == "error_page"'/>
        Page not found.
    <b:elseif cond='data:blog.url == data:blog.homepageUrl'/>
        No posts.
    </b:if>
<b:else/>
    <b:if cond='data:blog.searchLabel'>
        Posts for label: <b expr:data-search="data:blog.searchLabel"/>.
    <b:elseif cond='data:blog.searchQuery'/>
        Posts for query: <b expr:data-search="data:blog.searchQuery"/>.
    </b:if>
</b:if>

<data:blog.searchLabel/><data:blog.searchQuery/>是不安全的标签,因此最好通过 CSS 打印它们。

b[data-search]::after {
    content: attr(data-search);
}

关于blogger - blogspot 数据 :navMessage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21072954/

相关文章:

jquery - 如何在 H3 元素内对齐文本和图像

blogger - SyntaxHighlighter 不适用于 Blogger 动态 View ?

javascript - 如何将同一标签下的帖子列表的 URL 和标题存储到 Blogger 中的字符串数组中

css - 如何使用 CSS 删除图像下的这个 "a"空间?

html - Linkwithin-如何删除?

html - Blogspot。如何删除背景图片?它是我张贴的照片的副本

javascript - 不要在 Blogger 中缓存图像

html - 博客上带有变量的元关键字

python - 尝试使用 Blogger API 删除帖子返回 "not found"错误

java - 要向我的 blogger/blogspot 博客添加良好的 java 代码格式,我需要采取哪些步骤?