tags:

views:

672

answers:

4

I want to add the link tags to redirect my web-site to my OpenID provider. These tags should go in the head element. What's the best way to add them in Plone?

I understand that filling the head_slot is a way to do it, but that can only happen when you are adding a template to the page and that template is being rendered. In my case I'm not adding any template. Which template should I modify (that is not main_template.pt, which is my current solution, with it's huge drawbacks).

A: 

Plone documentation on supporting OpenID can be found here.

http://plone.org/documentation/how-to/openid-support/view?searchterm=openid

Hope this helps.

Nikki9696
Nikki9696, that's to have Plone acting as a receiver of OpenID, that's trivial. I want it to act as a provider. Putting tags on the header is for redirecting to another provider.
J. Pablo Fernández
+2  A: 

You need fill the head_slot defined in main_template.pt

In your base plone template, add the following:

<head>
    <metal:block metal:fill-slot="head_slot">
        <link rel="openid.server" href="http://your.provider"&gt;
        <link rel="openid.delegate" href="http://your.url"&gt;
    </metal:block>
</head>
michaeljoseph
How do I fill the head_slot by customizing a template? (note: I'm not writing a product)
J. Pablo Fernández
Whether you're customising a template TTW or overriding it entirely in a filesystem Product the approach should be the same- adding the fill-slot snippet in the head section of your new template should do the trick. I take it it's not working?
michaeljoseph
You say "your template" but I'm not sure what template is that. I am customizing TTW, and I couldn't find any other way than to customize main_template and add the header directly. What other template should I customize or create to add the snippet above and lean main_template alone?
J. Pablo Fernández
+1  A: 

In the end, you have to either place them directly in the main_template or you have to insert them in one of the slots in the mail_template.

What I have puts them in the style slot, next to the rest of the css/javascript links:

  <metal:myopenid fill-slot="style_slot">
    <link rel="openid.server" href="http://www.myopenid.com/server" />
    <link rel="openid.delegate" href="http://reinout.myopenid.com/" />
  </metal:myopenid>

You have to put this in a template somewhere. I put it in a separate homepage.pt as I was customizing the homepage anyway. This puts the openid headers just on the homepage. If you don't want a custom template, you can customize the document_view template (assuming your homepage is a document) and enter above snippet of code into it.

It would be best if there's an option for this in plone itself, similar to the "add javascript for statistics here" option.

Reinout van Rees
How is that homepage.pt being used or picked up by Plone?
J. Pablo Fernández
In genericsetup, you can set it as an available view for the PloneSite. That makes it selectable in the "display" menu. An alternative is to mimick the display menu action and do something like http://yoursite.com/selectViewTemplate?templateId=homepage .
Reinout van Rees
A: 

I couldn't understand how to fill a slot without a product or anything. I understand that you can fill a slot from a template, but if Plone is not picking up that template, then the filling code would never be run. I ended up modifying main_template and putting my code directly in the . This is bad because different skins will have different main_templates and indeed it bit me because I've modified it for one template when I was using the other. That is not a harmless-nothing-happens experience but a nasty problem because main_template in on custom and it gets picked up so you have one skin working with the main_template of the other. End result: UI broken with a hard-to-find problem.

This is the code I added:

<head>
   ...
   <link rel="openid.server" href="http://www.myopenid.com/server" />
   <link rel="openid.delegate" href="http://pupeno.myopenid.com/" />
   <link rel="openid2.local_id" href="http://pupeno.myopenid.com" />
   <link rel="openid2.provider" href="http://www.myopenid.com/server" />
   <meta http-equiv="X-XRDS-Location" content="http://www.myopenid.com/xrds?username=pupeno.myopenid.com" />
</head>

I will probably mark this answer as accepted because it's what I'm currently using (and that's my policy, I mark solutions I end up using as accepted, nothing else is marked as accepted), but if any of the other questions become clear in how to inject this new template, I will use that and revert the acceptance (if StackOverflow allows it).

J. Pablo Fernández