Insert meta tags into HTML head?

(7 posts) (2 voices)

Tags:

  1. duane, Member

    Hi,

    Is there any way to insert meta tags (with values derives from normal mydbr commands) between the <head> ...</head> of the HTML? I'd like to add open graph meta tags for when a report page is shared and I want specific titles, description and image to be picked up. At a minimum I'd like to use something like:

    <meta property="og:title" content="My generated report name based on the parameters"> <meta property="og:description" content="A description of my generated report name based on the parameters"> <meta property="og:image" content="http://mydomain.com/thumbnail.jpg"> <meta property="og:url" content="http://mydomain.com/index.htm"> <meta name="twitter:card" content="summary_large_image">

    I looked through the documentation but couldn't find an option. The last line is a custom Twitter meta tag in the example above is a slightly different format than the others, the the first four seem to be the open graph standard.

  2. myDBR Team, Key Master

    Duane,
    you can use dbr.javascript and jQuery append to add the tags under the head tag.

    --
    myDBR Team

  3. duane, Member

    Thanks - I'll try that out.

  4. duane, Member

    So I tried (as a test) adding
    SELECT 'dbr.javascript', "$('head').append('<meta property=\"og:type\" content=\"profile\"/>'); ", 'onload';
    and it didn't seem to work (there was nothing in the source other than the code).

    Is the jquery code (since there are references to jquery code) in mydbr by default with the append function to call?

  5. myDBR Team, Key Master

    Duane,
    the jQuery version works, but as it's done on the client, it is not best solution for META tags.

    if you run the automatic updater, you can try new (yet experimental) command dbr.head. To enable the command, add following entry to user/defaults.php:

    $mydbr_defaults['dbr_head']['enabled'] = true;

    The dbr.head command can be used as a first command in the report before the other commands or result sets. You can have multiple dbr.head-commands in the report. If you use the command after the other commands / results sets, the command is ignored.

    select 'dbr.head', '<meta property="og:type" content="profile"/>';

    Let us know if you have any problems.
    --
    myDBR Team

  6. duane, Member

    W.O.W. Your level of support astounds me and is one of the key reasons I keep using the paid version of myDBR - now in my 6th year.

    This works perfectly. I now have it set after a series of 'SET' and 'SELECT ... INTO' statements to get the variables from the tables/queries into the function and then use CONCAT statements to build the meta property....and it just works (I also tested on LinkedIn to see if it would detect the open graph meta tags and it worked as expected!)

    Thanks for your wonderful work - mydbr is my reporting workhorse and keeps improving as my needs/crazy ideas evolve.

    Duane

  7. myDBR Team, Key Master

    Duane,
    glad you continue to like myDBR. New feature ideas / suggestions are always welcomed.

    --
    myDBR Team


Reply

You must log in to post.