我成功地通过 javascript 更改了这些导航消息文本:
<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/