2015-08-21 83 views
7

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

大部分职位是这样的:

É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> 

凡三两件事改变:

  • 在顶部的文本( “练习曲德Exode 6.14-7.13” 中的例子)
  • 链接到声音文件(实际上是data:post.link,但我似乎无法在那里使用expr:src
  • 将引用传递给在biblia:bible标签(这里“Ex6.14-7.13”)

有没有一种方法,我可以用我的博客文章,而不是复制和手动每次改变事物的模板和变量?

+0

你想这样的模板编辑什么样的接口?您肯定知道[博客API]的存在(https://developers.google.com/blogger/docs/3.0/reference/posts/insert) – dvhh

+0

我想避免使用API​​维护外部系统。相反,我想知道变量是否可以在后期模板中声明/使用,就像它们可以在博客模板和小部件中一样。 –

回答

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> 

,然后使用它...

<b:include name='post' data='p' cond='index < 10'/> 

尽管我从来没有使用过博客作者,但这只是一个垃圾文章而已,这只是来自文档。

我从这里引用的材料:

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

+0

它看起来不错,但我根本无法工作。我必须更加努力。据我所知,小部件显然不能在帖子内部使用。 –

相关问题