Adjust nofollow attribute

This commit is contained in:
Alex Cabal 2024-11-26 13:41:00 -06:00
parent 351713f58e
commit e11f2ad6b1
5 changed files with 55 additions and 38 deletions

View file

@ -322,7 +322,7 @@ do
sed --in-place --regexp-extended "s|<body([^>]*)>|<body\1><header><nav><ul><li><a href=\"/\">Standard Ebooks</a></li><li><a href=\"${bookUrl}\">Back to ebook</a></li></ul></nav></header>|" "${workDir}"/single-page.xhtml sed --in-place --regexp-extended "s|<body([^>]*)>|<body\1><header><nav><ul><li><a href=\"/\">Standard Ebooks</a></li><li><a href=\"${bookUrl}\">Back to ebook</a></li></ul></nav></header>|" "${workDir}"/single-page.xhtml
# Adjust sponsored links in the colophon. # Adjust sponsored links in the colophon.
sed --in-place 's|<p><a href="http|<p><a rel="nofollow" href="http|g' "${workDir}"/single-page.xhtml sed --in-place 's|<p><a href="http|<p><a href="http|g' "${workDir}"/single-page.xhtml
if [ "${verbose}" = "true" ]; then if [ "${verbose}" = "true" ]; then
printf "Done.\n" printf "Done.\n"
@ -357,7 +357,7 @@ do
"${scriptsDir}"/inject-chapter-navigation-footer "${workDir}" "${bookUrl}" "${scriptsDir}"/inject-chapter-navigation-footer "${workDir}" "${bookUrl}"
# Adjust sponsored links in the colophon. # Adjust sponsored links in the colophon.
sed --in-place 's|<p><a href="http|<p><a rel="nofollow" href="http|g' "${workDir}"/src/epub/text/colophon.xhtml sed --in-place 's|<p><a href="http|<p><a href="http|g' "${workDir}"/src/epub/text/colophon.xhtml
# Done adding compatibility! # Done adding compatibility!

View file

@ -18,11 +18,19 @@
<? foreach($collections as $collection){ ?> <? foreach($collections as $collection){ ?>
<tr> <tr>
<td class="row-header"><a href="<?= $collection->Url ?>"><?= Formatter::EscapeHtml($collection->Label) ?></a></td> <td class="row-header"><a href="<?= $collection->Url ?>"><?= Formatter::EscapeHtml($collection->Label) ?></a></td>
<td class="number"><?= Formatter::EscapeHtml(number_format($collection->EbookCount)) ?></td> <td class="number">
<td class="number"><?= Formatter::EscapeHtml($collection->UpdatedString) ?></td> <?= Formatter::EscapeHtml(number_format($collection->EbookCount)) ?>
</td>
<td class="number">
<?= Formatter::EscapeHtml($collection->UpdatedString) ?>
</td>
<? foreach($collection->ZipFiles as $item){ ?> <? foreach($collection->ZipFiles as $item){ ?>
<td class="download"><a href="<?= $item->Url ?>"><?= $item->Type ?></a></td> <td class="download">
<td>(<?= Formatter::EscapeHtml($item->Size) ?>)</td> <a href="<?= $item->Url ?>"><?= $item->Type ?></a>
</td>
<td>
(<?= Formatter::EscapeHtml($item->Size) ?>)
</td>
<? } ?> <? } ?>
</tr> </tr>
<? } ?> <? } ?>

View file

@ -39,39 +39,48 @@ $title = preg_replace('/s$/', '', ucfirst($class));
<table class="download-list"> <table class="download-list">
<caption aria-hidden="hidden">Scroll right </caption> <caption aria-hidden="hidden">Scroll right </caption>
<tbody> <tbody>
<? foreach($collection as $year => $months){ <? foreach($collection as $year => $months){ ?>
$yearHeader = Formatter::EscapeHtml($year); <? $yearHeader = Formatter::EscapeHtml($year); ?>
?> <tr class="year-header">
<tr class="year-header"> <th colspan="13" scope="colgroup" id="<?= $yearHeader ?>">
<th colspan="13" scope="colgroup" id="<?= $yearHeader ?>"><?= Formatter::EscapeHtml((string)$year) ?></th> <?= Formatter::EscapeHtml((string)$year) ?>
</tr> </th>
<tr class="mid-header"> </tr>
<th id="<?= $yearHeader?>-type" scope="col">Month</th> <tr class="mid-header">
<th id="<?= $yearHeader ?>-ebooks" scope="col">Ebooks</th> <th id="<?= $yearHeader?>-type" scope="col">Month</th>
<th id="<?= $yearHeader ?>-updated" scope="col">Updated</th> <th id="<?= $yearHeader ?>-ebooks" scope="col">Ebooks</th>
<th id="<?= $yearHeader ?>-download" colspan="10" scope="col">Ebook format</th> <th id="<?= $yearHeader ?>-updated" scope="col">Updated</th>
</tr> <th id="<?= $yearHeader ?>-download" colspan="10" scope="col">Ebook format</th>
</tr>
<? foreach($months as $month => $collection){ <? foreach($months as $month => $collection){ ?>
$monthHeader = Formatter::EscapeHtml($month); <? $monthHeader = Formatter::EscapeHtml($month); ?>
?> <tr>
<tr> <th class="row-header" headers="<?= $yearHeader ?> <?= $monthHeader ?> <?= $yearHeader ?>-type" id="<?= $monthHeader ?>">
<th class="row-header" headers="<?= $yearHeader ?> <?= $monthHeader ?> <?= $yearHeader ?>-type" id="<?= $monthHeader ?>"><?= Formatter::EscapeHtml($month) ?></th> <?= Formatter::EscapeHtml($month) ?>
<td class="number" headers="<?= $yearHeader ?> <?= $monthHeader ?> <?= $yearHeader ?>-ebooks"><?= Formatter::EscapeHtml(number_format($collection->EbookCount)) ?></td> </th>
<td class="number" headers="<?= $yearHeader ?> <?= $monthHeader ?> <?= $yearHeader ?>-updated"><?= Formatter::EscapeHtml($collection->UpdatedString) ?></td> <td class="number" headers="<?= $yearHeader ?> <?= $monthHeader ?> <?= $yearHeader ?>-ebooks">
<?= Formatter::EscapeHtml(number_format($collection->EbookCount)) ?>
</td>
<td class="number" headers="<?= $yearHeader ?> <?= $monthHeader ?> <?= $yearHeader ?>-updated">
<?= Formatter::EscapeHtml($collection->UpdatedString) ?>
</td>
<? foreach($collection->ZipFiles as $item){ ?> <? foreach($collection->ZipFiles as $item){ ?>
<td headers="<?= $yearHeader ?> <?= $monthHeader ?> <?= $yearHeader ?>-download" class="download"><a href="<?= $item->Url ?>"><?= $item->Type ?></a></td> <td headers="<?= $yearHeader ?> <?= $monthHeader ?> <?= $yearHeader ?>-download" class="download">
<td headers="<?= $yearHeader ?> <?= $monthHeader ?> <?= $yearHeader ?>-download">(<?= Formatter::EscapeHtml($item->Size) ?>)</td> <a href="<?= $item->Url ?>"><?= $item->Type ?></a>
</td>
<td headers="<?= $yearHeader ?> <?= $monthHeader ?> <?= $yearHeader ?>-download">
(<?= Formatter::EscapeHtml($item->Size) ?>)
</td>
<? } ?>
</tr>
<? } ?>
<? } ?> <? } ?>
</tr>
<? } ?>
<? } ?>
</tbody> </tbody>
</table> </table>
<? }else{ ?> <? }else{ ?>
<?= Template::BulkDownloadTable(['label' => $title, 'collections' => $collection]); ?> <?= Template::BulkDownloadTable(['label' => $title, 'collections' => $collection]); ?>
<? } ?> <? } ?>
</section> </section>
</main> </main>

View file

@ -70,7 +70,7 @@
</li> </li>
</ul> </ul>
<p>Picking either the HTML or the epub version is fine as a starting point, but make sure to pick the one that appears to be the most accurate.</p> <p>Picking either the HTML or the epub version is fine as a starting point, but make sure to pick the one that appears to be the most accurate.</p>
<p>For this guide, well use <i>The Strange Case of Dr. Jekyll and Mr. Hyde</i>, by Robert Louis Stevenson. If you search for it on Gutenberg, youll find that there are two versions; we will use <a href="https://www.gutenberg.org/ebooks/43" rel="nofollow">this</a> one rather than <a href="https://www.gutenberg.org/ebooks/42" rel="nofollow">this</a> one, as it is a cleaner transcription, e.g. has more modern usage of punctuation and compound words, etc.</p> <p>For this guide, well use <i>The Strange Case of Dr. Jekyll and Mr. Hyde</i>, by Robert Louis Stevenson. If you search for it on Gutenberg, youll find that there are two versions; we will use <a href="https://www.gutenberg.org/ebooks/43">this</a> one rather than <a href="https://www.gutenberg.org/ebooks/42">this</a> one, as it is a cleaner transcription, e.g. has more modern usage of punctuation and compound words, etc.</p>
</li> </li>
<li> <li>
<h2 id="locate">Locate page scans of your book online</h2> <h2 id="locate">Locate page scans of your book online</h2>

View file

@ -205,7 +205,7 @@ catch(Exceptions\EbookNotFoundException){
<meta property="schema:description" content="epub"/> <meta property="schema:description" content="epub"/>
<meta property="schema:encodingFormat" content="application/epub+zip"/> <meta property="schema:encodingFormat" content="application/epub+zip"/>
<p> <p>
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= Enums\EbookFormatType::Epub->value ?>" class="epub">Compatible epub</a></span> <span></span> <span>All devices and apps except Kindles and Kobos.</span> <span><a property="schema:contentUrl" href="<?= $ebook->Url ?>/download?format=<?= Enums\EbookFormatType::Epub->value ?>" class="epub">Compatible epub</a></span> <span></span> <span>All devices and apps except Kindles and Kobos.</span>
</p> </p>
</li> </li>
<? } ?> <? } ?>
@ -214,7 +214,7 @@ catch(Exceptions\EbookNotFoundException){
<li property="schema:encoding" typeof="schema:MediaObject"> <li property="schema:encoding" typeof="schema:MediaObject">
<meta property="schema:encodingFormat" content="application/x-mobipocket-ebook"/> <meta property="schema:encodingFormat" content="application/x-mobipocket-ebook"/>
<p> <p>
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= Enums\EbookFormatType::Azw3->value ?>" class="amazon"><span property="schema:description">azw3</span></a></span> <span></span> <span>Kindle devices and apps.<? if($ebook->KindleCoverUrl !== null){ ?> Also download the <a href="<?= $ebook->KindleCoverUrl ?>">Kindle cover thumbnail</a> to see the cover in your Kindles library. Despite what youve been told, <a href="/help/how-to-use-our-ebooks#kindle-epub">Kindle does not natively support epub.</a> You may also be interested in our <a href="/help/how-to-use-our-ebooks#kindle-faq">Kindle FAQ</a>.<? }else{ ?> Also see our <a href="/how-to-use-our-ebooks#kindle-faq">Kindle FAQ</a>.<? } ?></span> <span><a property="schema:contentUrl" href="<?= $ebook->Url ?>/download?format=<?= Enums\EbookFormatType::Azw3->value ?>" class="amazon"><span property="schema:description">azw3</span></a></span> <span></span> <span>Kindle devices and apps.<? if($ebook->KindleCoverUrl !== null){ ?> Also download the <a href="<?= $ebook->KindleCoverUrl ?>">Kindle cover thumbnail</a> to see the cover in your Kindles library. Despite what youve been told, <a href="/help/how-to-use-our-ebooks#kindle-epub">Kindle does not natively support epub.</a> You may also be interested in our <a href="/help/how-to-use-our-ebooks#kindle-faq">Kindle FAQ</a>.<? }else{ ?> Also see our <a href="/how-to-use-our-ebooks#kindle-faq">Kindle FAQ</a>.<? } ?></span>
</p> </p>
</li> </li>
<? } ?> <? } ?>
@ -223,7 +223,7 @@ catch(Exceptions\EbookNotFoundException){
<li property="schema:encoding" typeof="schema:MediaObject"> <li property="schema:encoding" typeof="schema:MediaObject">
<meta property="schema:encodingFormat" content="application/kepub+zip"/> <meta property="schema:encodingFormat" content="application/kepub+zip"/>
<p> <p>
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= Enums\EbookFormatType::Kepub->value ?>" class="kobo"><span property="schema:description">kepub</span></a></span> <span></span> <span>Kobo devices and apps. You may also be interested in our <a href="/help/how-to-use-our-ebooks#kobo-faq">Kobo FAQ</a>.</span> <span><a property="schema:contentUrl" href="<?= $ebook->Url ?>/download?format=<?= Enums\EbookFormatType::Kepub->value ?>" class="kobo"><span property="schema:description">kepub</span></a></span> <span></span> <span>Kobo devices and apps. You may also be interested in our <a href="/help/how-to-use-our-ebooks#kobo-faq">Kobo FAQ</a>.</span>
</p> </p>
</li> </li>
<? } ?> <? } ?>
@ -232,7 +232,7 @@ catch(Exceptions\EbookNotFoundException){
<li property="schema:encoding" typeof="schema:MediaObject"> <li property="schema:encoding" typeof="schema:MediaObject">
<meta property="schema:encodingFormat" content="application/epub+zip"/> <meta property="schema:encodingFormat" content="application/epub+zip"/>
<p> <p>
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= Enums\EbookFormatType::AdvancedEpub->value ?>" class="epub"><span property="schema:description">Advanced epub</span></a></span> <span></span> <span>An advanced format that uses the latest technology not yet fully supported by most ereaders.</span> <span><a property="schema:contentUrl" href="<?= $ebook->Url ?>/download?format=<?= Enums\EbookFormatType::AdvancedEpub->value ?>" class="epub"><span property="schema:description">Advanced epub</span></a></span> <span></span> <span>An advanced format that uses the latest technology not yet fully supported by most ereaders.</span>
</p> </p>
</li> </li>
<? } ?> <? } ?>