Question

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).

Was it helpful?

Solution 3

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).

OTHER TIPS

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">
        <link rel="openid.delegate" href="http://your.url">
    </metal:block>
</head>

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.

Plone documentation on supporting OpenID can be found here.

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

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top