在博客帖子中使用变量

ℝap*_*ink 7 templates blogger

我正在使用博主制作播客.它工作得很好,但我发现自己复制/粘贴很多东西,当两个或三个变量和一个模板能很好地完成工作时.

大多数帖子看起来像这样:

Étude de Exode 6.14-7.13.
<br />
<audio controls>
  <source src="file.mp3" type="audio/mpeg">
  <embed height="50" width="100" src="file.mp3">
</audio>

<biblia:bible layout="minimal" resource="lsg" width="400" height="600" historyButtons="false" navigationBox="false" resourcePicker="false" shareButton="false" textSizeButton="false" startingReference="Ex6.14-7.13"></biblia:bible>
Run Code Online (Sandbox Code Playgroud)

三件事改变的地方:

  • 顶部的文字(示例中的"É​​tudedeExode 6.14-7.13.")
  • 声音文件的链接(实际上data:post.link,但我似乎无法在expr:src那里使用)
  • 传递给biblia:bible标签的引用(这里是'Ex6.14-7.13')

有没有办法可以为我的博客文章使用模板和变量,而不是每次都手动复制和更改内容?

Add*_*ons 1

我个人对博客并不熟悉,但看起来您可以创建一个小部件,并以这种方式分配变量:

<html
 xmlns  = 'http://www.w3.org/1999/xhtml' 
 xmlns:b  = 'http://www.google.com/2005/gml/b' 
 xmlns:data = 'http://www.google.com/2005/gml/data' 
 xmlns:expr = 'http://www.google.com/2005/gml/expr' 
>

<b:includable id='post' var='post'>

<data:post.title/>
<br />
<audio controls>
  <source src="<data:post.file/>" type="audio/mpeg">
  <embed height="50" width="100" src="<data:post.file/>">
</audio>

<biblia:bible layout="minimal" resource="lsg" width="400" height="600" historyButtons="false" navigationBox="false" resourcePicker="false" shareButton="false" textSizeButton="false" startingReference="<data:post.reference/>"></biblia:bible>

</b:includable>
Run Code Online (Sandbox Code Playgroud)

然后使用它...

<b:include name='post' data='p' cond='index < 10'/>
Run Code Online (Sandbox Code Playgroud)

这完全是废话,因为我个人从未使用过 blogger,这只是来自文档。

我参考这里的材料:

https://support.google.com/blogger/answer/46995?hl=en

http://thoughtsomething.blogspot.com/2009/01/understanding-blogger-template-1.html

http://helplogger.blogspot.com/2014/03/how-to-create-custom-color-and-font-variable-definitions-to-blogger.html