Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Has anyone added Schema to HTMLy? #628

Closed
AutomationMan808 opened this issue Aug 20, 2023 · 2 comments
Closed

Has anyone added Schema to HTMLy? #628

AutomationMan808 opened this issue Aug 20, 2023 · 2 comments

Comments

@AutomationMan808
Copy link

I'm trying to find a solution I could use in the layout file.

Rick

@bttrx
Copy link
Contributor

bttrx commented Dec 2, 2023

Please give a little more details.

@danpros
Copy link
Owner

danpros commented Jan 6, 2024

This can be done via theme. Example displaying only in blog post.

<?php if (isset($is_post)):?>
<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "Article",
    "headline": "<?php echo $p->title;?>",
    "url": "<?php echo $p->url;?>",
    "datePublished": "<?php echo format_date($p->date);?>",
    "dateModified": "<?php echo format_date($p->lastMod);?>",
}
</script>
<?php endif;?>

Just need to search the correct schema at `https://schema.org/`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants