title: Inject meta tag dynamically to HTML with Express
body: <p><strong>Summary:</strong></p>
  
  <p>I'm currently migrating a website on Apache + PHP stack over to Node + Express, and would like to know what is the best way/best practice (if there is one) for dynamically injecting meta tags under the new stack.</p>
  
  <p><strong>Details:</strong></p>
  
  <p>Under the existing stack, meta tags are injected dynamically by adding PHP codes into the HTML file directly. As rendering is done on server side, the tags are properly interpreted by Facebook/Google+/whatever web crawlers.</p>
  
  <p>Under the new stack, after doing some research, I've come across two options:</p>
  
  <ol>
  <li>Use template engine like Pug (Jade) to render the HTML with locals. (It seems to be an overkill to rewrite the existing HTML with Pug's syntax though? Can Pug deal with HTML, or I've to consider other template engine like EJS? What template engine do you advise me to explore?)</li>
  <li>Use DOM manipulation plugin like Cheerio to inject the meta tags first, before rendering begins.</li>
  </ol>
  
  <p>Between these two options, which one will have a better performance or there is no material difference? Are there any other ways that you'd otherwise recommend? Thanks!</p>