drupal-graphql / graphql-metatag

6 stars 13 forks source link

[QUESTION] Is possible to change __typename for title? #10

Open sixtyniner-official opened 5 years ago

sixtyniner-official commented 5 years ago

Hi,

on my current project have following function:

_headMetaTagRedered(typename, key, value, index) {
        switch (typename) {
            case "MetaLink":
                return(
                    <link key={index} rel={key} href={value} />
                );
            case "MetaValue":
                return(
                    <meta key={index} name={key} content={value}/>
                );
            default:
                return;
        }
    };

Idea is to print all meta tags in one loop

<Head>
    {data.route.entity.metaTags.map((tag, index) => {
           return(
                this._headMetaTagRedered( tag.__typename, tag.key, tag.value, index)
          )
     })}
</Head>

But key value for title is MetaValue so is not possible to make right switch case check to print <title>{value}</title>

Could you consider the case above and give as feedback if title have to be MetaValue?

Luigisa commented 4 years ago

Hi, you can add an alias before:

title: tag.__typename