Recommended HTML head links
HTML, Metadata, Head · Jan 26, 2023
<link> elements, however, are important for SEO and metadata purposes. Here's a list of a few really important ones I like to include:
<head> <link rel="canonical" href="https://samplesite.com/page.html"> <link rel="sitemap" type="application/xml" href="https://samplesite.com/sitemap.xml"> <link rel="alternate" type="application/rss+xml" title="RSS" href="https://samplesite.com/rss.xml"> <link rel="search" type="application/opensearchdescription+xml" title="Search" href="https://samplesite.com/search.xml"> </head>
canonicallink element tells search engines which URL is the canonical version of the page. This helps prevent duplicate content issues and ensures that the correct page is indexed.
sitemaplink element tells search engines where to find the sitemap for the website. Sitemaps are XML files that contain a list of all the pages on the website and their metadata. They are used by search engines to index the website and display it in search results.
alternatelink element tells search engines where to find the RSS feed for the website. RSS feeds are XML files that contain a list of the most recent posts on the website. They are used by search engines to display the website's content in search results, as well as by RSS readers to display the website's content in a more convenient format.
searchlink element is used by browsers to display a search box in the browser's address bar. This allows users to search the website directly from the address bar, instead of having to navigate to the search page.
Written by Angelos Chalaris
If you want to keep in touch, follow me on GitHub.