mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 23:30:35 -04:00
Switch from JSON-LD to RDFa for internal metadata
This commit is contained in:
parent
a12200c1ac
commit
99f1c1537a
7 changed files with 125 additions and 36 deletions
|
@ -8,20 +8,26 @@ if(!isset($ebooks)){
|
|||
$ebooks = [];
|
||||
}
|
||||
?>
|
||||
<ol<? if($view == VIEW_LIST){ ?> class="list"<? } ?>>
|
||||
<ol<? if($view == VIEW_LIST){ ?> class="list"<? } ?><? if($collection !== null){ ?> typeof="schema:BookSeries" about="<?= $collection->Url ?>"<? } ?>>
|
||||
<? if($collection !== null){ ?>
|
||||
<meta property="schema:name" content="<?= Formatter::ToPlainText($collection->Name) ?>"/>
|
||||
<? } ?>
|
||||
<? foreach($ebooks as $ebook){ ?>
|
||||
<li>
|
||||
<a href="<?= $ebook->Url ?>" tabindex="-1">
|
||||
<li typeof="schema:Book"<? if($collection !== null){ ?> resource="<?= $ebook->Url ?>" property="schema:hasPart" value="<?= $ebook->GetCollectionPosition($collection) ?>"<? }else{ ?> about="<?= $ebook->Url ?>"<? } ?>>
|
||||
<? if($collection !== null){ ?>
|
||||
<meta property="schema:position" content="<?= $ebook->GetCollectionPosition($collection) ?>"/>
|
||||
<? } ?>
|
||||
<a href="<?= $ebook->Url ?>" tabindex="-1" property="schema:url">
|
||||
<picture>
|
||||
<? if($ebook->CoverImage2xAvifUrl !== null){ ?><source srcset="<?= $ebook->CoverImage2xAvifUrl ?> 2x, <?= $ebook->CoverImageAvifUrl ?> 1x" type="image/avif"/><? } ?>
|
||||
<source srcset="<?= $ebook->CoverImage2xUrl ?> 2x, <?= $ebook->CoverImageUrl ?> 1x" type="image/jpg"/>
|
||||
<img src="<?= $ebook->CoverImage2xUrl ?>" title="<?= Formatter::ToPlainText($ebook->Title) ?>" alt="The cover for the Standard Ebooks edition of <?= Formatter::ToPlainText(strip_tags($ebook->TitleWithCreditsHtml)) ?>"/>
|
||||
<img src="<?= $ebook->CoverImage2xUrl ?>" title="<?= Formatter::ToPlainText($ebook->Title) ?>" alt="The cover for the Standard Ebooks edition of <?= Formatter::ToPlainText(strip_tags($ebook->TitleWithCreditsHtml)) ?>" property="schema:image"/>
|
||||
</picture>
|
||||
</a>
|
||||
<p><a href="<?= $ebook->Url ?>"><?= Formatter::ToPlainText($ebook->Title) ?></a></p>
|
||||
<p><a href="<?= $ebook->Url ?>" property="schema:url"><span property="schema:name"><?= Formatter::ToPlainText($ebook->Title) ?></span></a></p>
|
||||
<? if($view == VIEW_GRID){ ?>
|
||||
<? foreach($ebook->Authors as $author){ ?>
|
||||
<p class="author"><? if($author->Name != 'Anonymous'){ ?><a href="<?= Formatter::ToPlainText($ebook->AuthorsUrl) ?>"><?= Formatter::ToPlainText($author->Name) ?></a><? } ?></p>
|
||||
<p class="author" typeof="schema:Person" property="schema:author" resource="<?= $ebook->AuthorsUrl ?>"><? if($author->Name != 'Anonymous'){ ?><a href="<?= Formatter::ToPlainText(SITE_URL . $ebook->AuthorsUrl) ?>" property="schema:url"><span property="schema:name"><?= Formatter::ToPlainText($author->Name) ?></span></a><? } ?></p>
|
||||
<? } ?>
|
||||
<? }else{ ?>
|
||||
<div>
|
||||
|
|
|
@ -23,7 +23,7 @@ print('<?xml version="1.0" encoding="utf-8"?>');
|
|||
print("\n");
|
||||
?><!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<head prefix="twitter: https://twitter.com schema: https://schema.org"><? /* the og RDFa prefix is part of the RDFa spec */ ?>
|
||||
<meta charset="utf-8"/>
|
||||
<title><? if($title != ''){ ?><?= Formatter::ToPlainText($title) ?> - <? } ?>Standard Ebooks: Free and liberated ebooks, carefully produced for the true book lover.</title>
|
||||
<? if($description != ''){ ?><meta content="<?= Formatter::ToPlainText($description) ?>" name="description"/><? } ?>
|
||||
|
@ -49,11 +49,6 @@ print("\n");
|
|||
<meta content="summary_large_image" name="twitter:card"/>
|
||||
<meta content="@standardebooks" name="twitter:site"/>
|
||||
<meta content="@standardebooks" name="twitter:creator"/>
|
||||
<? if(isset($jsonld)){ ?>
|
||||
<script type="application/ld+json">
|
||||
<?= $jsonld ?>
|
||||
</script>
|
||||
<? } ?>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue