Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

18. The Preferred-Source Button

The Preferred-Source Button

Copy each block and paste it where the comment at the top of the block says. 1 file in this pack.

preferred-sources-button.html

<!--
HOW TO INSTALL THIS FILE

In the words of the company that published the specification:

Google: "Embed an interactive button to your web pages, which lets readers seamlessly
add your site as a preferred source and returns them to your page. By adding only two
lines to your HTML, this option renders an automatically localized, Google-styled
button that supports device and language customization."

source: developers.google.com/search/docs/appearance/preferred-sources
-->

1. This line goes in the <head> of every page:

<script async src="https://news.google.com/swg/js/v1/publisher.js"></script>

2. This line goes wherever you want the button to appear:

<div google-add-preferred-source-btn></div>

3. If your site cannot run the script, this plain link does the
   same job without it:

<a href="https://www.google.com/preferences/source?q=vitadefence.com">Add us as a preferred source</a>

Google's own badge artwork, all languages:
https://services.google.com/fh/files/helpcenter/google_preferred_source_badge_all_languages.zip