The <link>
tag used between the <head></head>
tags is used to load resources outside the page into the page.
The rel=""
attribute determines the use of the <link>
tag.
The rel="stylesheet"
link tag use to call the external CSS files used on the page.
<link rel="stylesheet" href="https://example.com/style.css" type="text/css" media="all" />
Use the canonical rel="canonical"
<link> attribute, which it uses to specify the canonical URL of the page.
<link rel="canonical" href="https://example.com/"/>
To add a favicon to the page, the rel="icon"
<link> tag use in the page’s source code.
<link rel="icon" href="https://example.com/icon-32.png" sizes="32x32" />
<link rel="icon" href="https://example.com/icon-32.png" sizes="1922x922" />
The rel="alternate"
<link>
tag use to specify alternative pages of web pages in foreign languages.
<link rel="alternate" href="https://juniortoexpert.com/de/" hreflang="de" />
<link rel="alternate" href="https://juniortoexpert.com/en/" hreflang="en" />
<link rel="alternate" href="https://juniortoexpert.com/tr/" hreflang="tr" />
<link rel="alternate" href="https://juniortoexpert.com/fr/" hreflang="fr" />
<link rel="alternate" href="https://juniortoexpert.com/" hreflang="x-default" />
rel="dns-prefetch"
, rel="preconnect"
, rel="preload"
are used to speed up the page load process.
<link rel="dns-prefetch" href="https://tagmanager.google.com/" />
<link rel="preconnect" href="https://example.com">
<link rel="preload" href="/assets/Pacifico-Bold.woff2" as="font" type="font/woff2">
It is recommended to use <link> tags inside <head> tags in HTML architecture, but the <link> tag works when positioned outside the <head> tag.
Source: