我通过javascript成功更改了这些navmessage文本:
<div class='status-msg-body'
<script
var str='<data:navMessage/';
str2=str.replace("Visualizzazione dei post in ordine di pertinenza per la query","Articoli
contenenti:").replace("Visualizzazione post con
etichetta","Articoli appartenenti alla
categoria:").replace("Nessun post corrispondente alla
query","Nessun articolo contiene");
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/