[Factory Configuration] Factory Configuration - Add Meta Tag to Head 

[Factory Configuration] Factory Configuration - Add Meta Tag to Head 

  
Forge Component
(12)
Published on 27 Feb by OutSystems R&D
12 votes
Published on 27 Feb by OutSystems R&D

Hi,

I'm trying to add the following Meta Tag to the <Head></Head> of every screen in our project:

<meta name="google" content="notranslate" />

Has anyone ever used Factory Configuration to do so?

Thanks,

Hernâni F. 


Hello Hernani,

You can use AddMetaTag action from HttpRequestHandler API.


https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/HTTPRequestHandler_API#AddMetaTag

João Heleno wrote:

Hello Hernani,

You can use AddMetaTag action from HttpRequestHandler API.


https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/HTTPRequestHandler_API#AddMetaTag

Hi, João.

First of all, thank you for your reply. 

I'm familiar with the AddMetaTag action, though. I wanted a solution that did not require adding the meta tag with each preparation... do you know of an alternative?

Thanks,

Hernâni

You don't need to do it in each preparation, Just place it in the preparation of a block inside your layout (or in your layout).

You can try adding system event OnBeginWebRequest. All the logic in there will be performed in all the requests to the server.

Maybe it's an option you can try. 


Edit: can't attach image. Somethings wrong with the upload.

https://success.outsystems.com/Documentation/10/Reference/Platform_Utilities/System_Events/On_Begin_Web_Request



João Rosado wrote:

You don't need to do it in each preparation, Just place it in the preparation of a block inside your layout (or in your layout).

Hi, João.

That's actually the way I have it right now - was trying to get a better (?) alternative.

Thanks,

Hernâni

Solution

Think the layout is still the better alternative. You just need to do it in one place and all your applications that share the same layout will get it.

For example the meta tags for the responsive themes (to work correctly in mobile devices) are being done the same way ..hidden away in one of the Silk/Templates blocks in all the layouts.


I personally don't like the OnBeginWebRequest as that cannot be shared between modules, so all the modules would have to have it with copy pasted logic in all of them.  Preparation in a block placed inside the layout is by far a better option.


Regards,
João Rosado

Solution

@João Rosado and @João Heleno:

Thanks for your help, I'll go with João Rosado's suggestion.

@Hernani

The web block option is the correct one!

Mine was more "hardcore" and unnecessary in your case.