Reputation: 3665
I'm using blogger to make a podcast. It works really well, but I find myself copy/pasting a lot of things, when two or three variables and a template would do the job really well.
Most of the posts look like this:
É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>
Where three things change:
data:post.link
, but I can't seem to be able to use expr:src
there unfortunately)biblia:bible
tag (here 'Ex6.14-7.13')Is there a way I could use a template and variables for my blog posts instead of copying and changing things manually every time?
Upvotes: 7
Views: 3079
Reputation: 3409
You can, however, convert a string object into valid Blogger XML data. So, first, you need to write this object as your post content (make sure you are in the HTML mode):
{
text: "Étude de Exode 6.14-7.13.",
source: "file.mp3",
ref: "Ex6.14-7.13"
}
After that, inside your blog template, find <data:post.body/>
then replace with this:
<b:with var='param' expr:value='data:post.body'>
<data:param.text/>
<br/>
<audio controls='controls'>
<source expr:src='data:param.source' type='audio/mpeg'/>
<embed height='50' width='100' expr:src='data:param.source'/>
</audio>
<biblia:bible layout='minimal' resource='lsg' width='400' height='600' historyButtons='false' navigationBox='false' resourcePicker='false' shareButton='false' textSizeButton='false' expr:startingReference='data:param.ref'/>
</b:with>
Here’s the basic concept: https://www.dte.web.id/2018/07/custom-blogger-widget.html
Upvotes: 4
Reputation: 1637
I am not personally familiar with blogger, but it looks like you can create a widget, and assign variables that way:
<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>
and then to use it...
<b:include name='post' data='p' cond='index < 10'/>
This is a total crap shoot though as I have never used blogger personally, this is just from documentation.
I am referencing material from here:
https://support.google.com/blogger/answer/46995?hl=en
http://thoughtsomething.blogspot.com/2009/01/understanding-blogger-template-1.html
Upvotes: 1