Skip to Content
Menu
This question has been flagged
1 Reply
8324 Views

Hello there,

I'm searching the way to directly attrib a variable value to an attribute of a tag :

    <template id="website_lapagept.facebook_open_graph_tags_iv">

        <t t-set="variable" t-value="FFRGRGRGFGFGFBVFVFGGFGFGFVF" />

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

        <meta property="og:type" content=variable />  (IT DOESN'T WORK)

    </template>


Could you help me please?


UPDATE #1

ref : https://www.odoo.com/fr_FR/forum/help-1/question/append-value-to-attribute-in-qweb-template-76953

If I inherit the above template, I can change the « content » attribute value. But it is not what I want. Can we do this without inheritance and without xpath?

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

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

                    <attribute name="content">Intime &amp; vilain</attribute>

            </xpath>

    </template>


UPDATE #2

This new way doesn't work too :

    <template id="website_lapagept.facebook_open_graph_tags_iv">

        <t t-set="variable" t-value="FFRGRGRGFGFGFBVFVFGGFGFGFVF" />

        <meta t-att="{'property':'og:type', 'content':variable}" />

</template>


UPDATE #3

This new way doesn't work too : 

    <template id="website_lapagept.facebook_open_graph_tags_iv">

        <t t-set="variable" t-value="FFRGRGRGFGFGFBVFVFGGFGFGFVF" />  

        <meta property="og:type" t-att-content="variable" />

    </template>

Avatar
Discard
Author Best Answer

This one works. It was what we needed.

<t t-if="main_object and 'description_sale' in main_object and main_object.description_sale">

    <t t-set="og_description_sale" t-value="main_object.description_sale"/>

    <meta property="og:description" t-att-content="og_description_sale" />

</t>

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 21
2221
1
Aug 23
3798
2
May 20
8611
1
Jul 23
1437
0
Sep 19
14741