Adding to <head> in an extension template

12 views
Skip to first unread message

Jeff Schnitzer

unread,
May 3, 2012, 8:21:04 PM5/3/12
to cambridge...@googlegroups.com
I'm trying to add a <link> element to the <head> of a document from an
extension template. Using <a:span> doesn't seem to work at all -
there is nothing added to my <head>. Am I doing something wrong? I
can't use <div> because this goes into <head>.

Here's the base template:

<!doctype html>
<html>
<head>
<title>Test Title</title>

<a:span id="headExtra"></a:span>
</head>
<body>
<div id="bodyContent"></div>
</body>
</html>

Here's the extension:

<!--$extends admin/testBody.html -->
<a:span id="headExtra">
<link rel="stylesheet" type="text/css" href="/blah.css" />
</a:span>
<div id="bodyContent">
<p>Foo</p>
</div>

Thanks,
Jeff

Jeff Schnitzer

unread,
Jul 6, 2012, 5:52:47 AM7/6/12
to cambridge...@googlegroups.com
Is there any way to make this work?

Thanks,
Jeff

Erdinc Yilmazel

unread,
Jul 6, 2012, 8:17:26 AM7/6/12
to cambridge...@googlegroups.com
I will look tonight.

Erdinc Yilmazel

unread,
Jul 6, 2012, 11:57:18 PM7/6/12
to cambridge...@googlegroups.com
Hi Jeff.

The problem gets resolved with the patch attached. I commited this change to the githup repository as well. Here is the brief explanation of what was happening. When you have a dynamic tag like <a:span> all of the attributes of that tag are also considered dynamic. 

It means <a:span id="xxx"> is in fact gets evaluated as <a:span a:id="xxx">. I designed it this way to save developers from typing so you can just say <a:span if="xxx"> etc. Anyway, what was happening was, it was looking for the attribute id but not looking for a:id in the sub template.

If you want to get this working without applying the patch, there is an alternative way which works fine. Instead of overriding the super template nodes by identifying them with the id attribute, you can use the overrides attribute.

In your example the extension would have, <a:span overrides="#headExtra">. overrides attribute accepts any valid cambridge selector. 

Thanks,

Erdinc
bugfix.patch

Jeff Schnitzer

unread,
Jul 7, 2012, 2:42:08 PM7/7/12
to cambridge...@googlegroups.com
Ah hah! That makes sense. Thanks for the fix :-)

Jeff
Reply all
Reply to author
Forward
0 new messages