What is the best way to create different meta tags on the site through php?

Hello !
What is the best option for creating different meta tags on a site?

html meta tags? why are you using php?

Hello! Soon I’m exploring how to make these meta tags and I did not suppose there was a better way than php. Can you share an alternative with me?

meta tags are part of HTML, which is text, which you can output with echo.

1 Like
<?php printf("this would be where you put the meta tag stuff %s", $someKindOfPhpVar); ?>

I like printf better than echo for the formatting. :wink:
You can use printf to print anything out in html tags or even javascript for that matter.

I have page titles and descriptions in a db table. At the top of the page before the html header, a sql query grabs that info based on the page being loaded. Then it’s used as the page title and meta description.

You can always add customization to those fields as well.

For example: My player-finder has individual pages for each member’s “gamer biography.” So each of those pages have the member id in the page title. You can see my own gamer biography at Find Gamers as an example.

Sponsor our Newsletter | Privacy Policy | Terms of Service