2015-08-21 82 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

它看起來不錯,但我根本無法工作。我必須更加努力。據我所知,小部件顯然不能在帖子內部使用。 –

相關問題