Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

What is the xpath selector to get facebook open graph tag in my <head> section?

By
Pascal Tremblay
on 9/22/15, 2:22 PM 1,118 views

Hello all,

I'm searching the right xpath expr selector to change the content attribute of each of those Facebook open graph tag in the < head> section of my main template.

Someone could help?

Thanks

<template id="website_lapagept.facebook_open_graph_description_iv" inherit_id="website_lapagept.website_layout_iv" name="Facebook open graph description - IV">

        <xpath expr='//head/meta[@property="og:title"]' position="attributes">

                <attribute name="content">Intime et vilain</attribute>

        </xpath>

</template>


<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<template id="website_lapagept.website_layout_iv" name="Main layout - IV">&lt;!DOCTYPE html&gt;

<html t-att-lang="lang and lang.replace('_', '-')">

<head>

        <meta charset="utf-8" />

        <meta t-attf-property="og:title" t-attf-content="marde de" />

        <meta t-attf-property="og:type" t-attf-content="marde de" />

        <meta t-attf-property="og:image" t-attf-content="marde de" />

        <meta t-attf-property="og:site_name" t-attf-content="marde de" />

        <meta t-attf-property="og:description" t-attf-content="marde de christ" />


[......]


UPDATE : I tried those expressions with no luck :

    expr="//meta[@property="og:title"]/@content"

1

Pascal Tremblay

--Pascal Tremblay--
1312
| 5 2 7
Alma, Canada
--Pascal Tremblay--


Pascal Tremblay
On 9/22/15, 2:35 PM

Here is a solution that works!

<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<template id="website_lapagept.website_layout_iv" name="Main layout - IV">&lt;!DOCTYPE html&gt;

<html t-att-lang="lang and lang.replace('_', '-')"

t-att-data-website-id="website.id if editable and website else None"

t-att-data-editable="'1' if editable else None"

t-att-data-translatable="'1' if translatable else None"

t-att-data-view-xmlid="xmlid if editable else None"

t-att-data-main-object="repr(main_object) if editable else None"

t-att-data-oe-company-name="res_company.name">

<head>

<meta charset="utf-8" />

<!-- <t t-call="website_lapagept.facebook_open_graph_description_iv">

</t>-->

<meta property="og:title" content="marde de " />

<meta property="og:type" content="marde de " />

<meta property="og:image" content="marde de " />

<meta property="og:site_name" content="marde de " />

<meta property="og:description" content="marde de " />


AND


<template id="website_lapagept.facebook_open_graph_description_iv" inherit_id="website_lapagept.website_layout_iv" name="Facebook open graph description - IV">

<xpath expr='//meta[@property="og:title"]' position="attributes">

<attribute name="content">Intime et vilain</attribute>

</xpath>

</template>


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 9/22/15, 2:22 PM
Seen: 1118 times
Last updated: 9/22/15, 2:36 PM