Answers.Body: <p>There's a <a href="https://plugins.craftcms.com/connect" rel="nofollow noreferrer">plugin that allows you to connect to an external database</a>, which will allow you to do a query within the template. Remember to cache the result though as it could slow things down otherwise.</p>
  <p>Another option is to sync the external data with Craft using <a href="https://plugins.craftcms.com/feed-me" rel="nofollow noreferrer">feed me</a>, so you can pull the data locally.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-16T15:37:15.680Z
Answers.Text: What about to get the data first prior the template rendering? How do I get to do this? a Plugin? a Module? a Controller? Thanks!
Answers.UserDisplayName: Rafael Mora
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-17T08:44:48.133Z
Answers.Text: Yes you can create a module with a controller that can render a template: https://craftcms.com/docs/3.x/extend/controllers.html#rendering-templates
Answers.UserDisplayName: dmatthams
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-11T15:10:34.943Z
Answers.LastActivityDate: 2020-08-11T15:10:34.943Z
Answers.UserDisplayName: dmatthams
Body: <p>I need to put some <code>&lt;meta /&gt;</code> tags in the <code>&lt;head /&gt;</code> section of the html document prior the rendering of the template. I would like to know how can I achieve this? I also need to query an external database in order to get some data from it and populate the meta tags. What I want to accomplish is to pass a link to my website and get Twitter to display a card with the image, description, etc.</p>
  <p>What is the best option in order to accomplish this task? a Plugin? a Controller? a Module? Does anybody know any good tutorial or guide in order to do this?</p>
  <p>I'm using CraftCMS ver 3.4.9</p>
  <p>Thank you in advance for your support.</p>
  
Tags: <php><seo><meta>
Title: Put SEO and Twitter card Meta tags in the Head section prior the render of the template
ThreadText: # Put SEO and Twitter card Meta tags in the Head section prior the render of the template
  
  (Asked by: username_0 on 2020-08-11)
  
  I need to put some `<meta />` tags in the `<head />` section of the html document prior the rendering of the template. I would like to know how can I achieve this? I also need to query an external database in order to get some data from it and populate the meta tags. What I want to accomplish is to pass a link to my website and get Twitter to display a card with the image, description, etc.
  
  What is the best option in order to accomplish this task? a Plugin? a Controller? a Module? Does anybody know any good tutorial or guide in order to do this?
  
  I'm using CraftCMS ver 3.4.9
  
  Thank you in advance for your support.
  
  **Tags:** php, seo, meta
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-08-11. Score: 1
  
  There's a [plugin that allows you to connect to an external database](https://plugins.craftcms.com/connect), which will allow you to do a query within the template. Remember to cache the result though as it could slow things down otherwise.
  
  Another option is to sync the external data with Craft using [feed me](https://plugins.craftcms.com/feed-me), so you can pull the data locally.
  
  > **Comments:**
  > **username_0**: What about to get the data first prior the template rendering? How do I get to do this? a Plugin? a Module? a Controller? Thanks!  
  > **username_1**: Yes you can create a module with a controller that can render a template: https://craftcms.com/docs/3.x/extend/controllers.html#rendering-templates  
  
  ---
  
  