我想在我的Tumblr博客上为每个帖子页面添加JavaScript代码.我有以下,但它似乎从来没有出现单独让任何页面上只固定链接或个别帖子页.我在这里尝试了许多变体,删除Posts块或PermalinkPage块无济于事.我在这做错了什么?
<!-- Start JS -->
{block:Posts}
{block:PermalinkPage}
<script type='text/javascript'>
__config = {
{block:Date},date:'{Year}-{MonthNumberWithZero}-{DayOfMonthWithZero} {24HourWithZero}:{Minutes}:{Seconds}'{/block:Date}
{block:PostSummary},title:{JSPlaintextPostSummary}{/block:PostSummary}
{block:HasTags},tags:[{block:Tags}'{Tag}', {/block:Tags}],{/block:HasTags}
,url:'{URLEncodedPermalink}'
};
(function(){
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = document.location.protocol + '//example.com/example.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(s);
})();
</script>
{/block:PermalinkPage}
{/block:Posts}
<!-- END JS -->
Run Code Online (Sandbox Code Playgroud) 由于Tumblr主题编辑器中的错误\n
,只要序列出现在源代码中,它就会转换为源代码本身中的实际换行符.因此,将\n
序列放入Javascript字符串会导致程序崩溃,因为它会将字符串分成多行.
我想知道是否有另一种方法可以在JavaScript中记录换行符,这可以让我解决这个问题.
我希望能让我的Tumblr博客更加适合移动设备,我希望在我的桌面主题旁边使用移动主题.我看到我可以使用移动设备的默认移动主题,但有没有办法让我自定义移动主题,但仍保留我的常规主题桌面?
Due to problems with autoscrolling, I had to replace my blog theme on Tumblr. On this new theme all external links open on a new tab, even after deleting all the target="_blank">
on the code.
When I try the code on the blog itself it puts the target="_blank">
back in the code.
If for example I leave a link like this:
<a href="EXTERNAL-WEB-SITE-GOES-HERE">
<svg class="social-accounts-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 242.8 242.8" enable-background="new 0 0 242.8 242.8" xml:space="preserve">
<path …
Run Code Online (Sandbox Code Playgroud) 我想在博客的索引页面中隐藏任何带有特定标签的帖子.
有问题的主题是禅宗主题的Pation.
<!DOCTYPE html>
<!--[if IE 8]><html class="lt-ie10 lt-ie9"> <![endif]-->
<!--[if IE 9]><html class="lt-ie10"> <![endif]-->
<!--[if gt IE 9]><!--><html><!--<![endif]-->
<head>
{MobileAppHeaders}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!--
Pation | Zen Themes
Release Date: Dec 7th, 2016
Last Update: Apr 23rd, 2016
-->
<title>{Title}{block:SearchPage} ({lang:Search results for SecarchQuery}){/block:SearchPage}{block:PermalinkPage}{block:PostSummary} — {PostSummary}{/block:PostSummary}{/block:PermalinkPage}</title>{block:Description}<meta name=description content="{MetaDescription}">{/block:Description}<link rel=alternate type=application/rss+xml href={RSS}><link rel="shortcut icon" href={Favicon}><link rel=apple-touch-icon-precomposed href={PortraitURL-128}>
{block:Hidden}
<meta name=image:Logo content="">
<meta name=image:Background content="">
<meta name=color:Background content=#ffffff>
<meta name=color:Title content=#111111>
<meta name=color:Text content=#555555>
<meta name=color:Accent content=#0040ff> …
Run Code Online (Sandbox Code Playgroud)