tannerdolby / eleventy-plugin-metagen

Eleventy shortcode that generates document metadata
https://www.npmjs.com/package/eleventy-plugin-metagen
MIT License
41 stars 3 forks source link

Twitter summary_large_image #9

Closed tpiros closed 3 years ago

tpiros commented 3 years ago

How would one configure your plugin to generate a large image preview card for Twitter via the summary_large_image?

tannerdolby commented 3 years ago

@tpiros Thank you for bringing this to my attention. Currently, the plugin doesn't generate a summary_large_image to provide a large image preview for the Twitter Summary card.

I will add support for summary_large_image by the end of day.

tpiros commented 3 years ago

Sounds awesome. I did change it around locally, doesn't seem to be a massive change. Appreciate the fast response!

tannerdolby commented 3 years ago

No problem! Yeah your right, not a massive change. I'm planning on adding another parameter to the shortcode, twitter_card_type that will take a string parameter to define the content for <meta name="twitter:card">. The default value will be content="summary" if the twitter_card_type param isn't defined or is an empty string. I'll ping you in the morning when it's updated.

Usage:

<head>
  <!-- creates <meta name="twitter:card content="summary_large_image" -->
  {% metagen 
      title="Some title",
      ...
      twitter_card_type="summary_large_image",
      ...
  %}
</head>

Without the param twitter_card_type defined or if its an empty string:

<head>
  <!-- creates <meta name="twitter:card content="summary" -->
  {% metagen 
      title="Some title",
      ... 
      ...
  %}
</head>
tannerdolby commented 3 years ago

@tpiros Fixed with commit 3b8a551 🎉 🚀

After running npm update on my personal website code, the plugin works as expected. Providing the large summary image in Twitter card if twitter_card_type="summary_large_image" was used.

Screen Shot 2021-04-21 at 12 40 53 AM
tpiros commented 3 years ago

@tannerdolby awesome job! Checked and works as expected! And it works amazingly well with my auto social share card generator! :-)

Screenshot 2021-04-21 at 14 19 07
tannerdolby commented 3 years ago

@tpiros thanks! I'm glad everything is working as expected. Your social share card created by the generator looks great! Feel free to let me know if you encounter any bugs.