This section illustrates implementations an usage of HTML meta elements and Client Side Scripting components.
HTML metadata
The <head> is implemented by the Head class. The
<head> contains information such as the page <title>,
links to external resources, and other metadata (data that describes the document).
The following list describe HTML meta data components:
Titleinstance → <title>tag: Sets the name of the page shown in the browser tab and is crucial for SEO.
NamedMetainstance → <meta>tag: Provides details like character encoding (usually UTF-8), page descriptions, and viewport settings for mobile responsiveness.
The meta-keyword tag is not used by SEO tools, and it has no effect on
indexing and ranking at all.
[1]
LinkInterfaceimplementations → <link>tag: Connects the HTML to external resources, most commonly CSS stylesheets or favicons.
Scriptimplementations → <script>tag:Script implementations are used to embed or link to JavaScript files that add interactivity to the page.
Noscriptinstance → <noscript>tag: Used if a script type on the page is unsupported or if scripting is currently turned off in the browser.[2]
Styleinstance → <style>tag: Allows you to write CSS rules directly within the HTML document.
Baseinstance → <base>tag: Specifies a default URL or target for all relative links on the page.
Meta data can be described also in a PHP array or an YAML file.
SPHPlayground is capable to transform this data to an HTML head component,
Links
The <link> HTML element specifies relationships between the current
document and an external resource. A <link> element can occur either in
the <head> or <body> element, depending on whether it has a link
type that is body-ok.[3]
All HTML links implement LinkInterface interface. And as
mentioned above the Rel defines the relationship between the current document
and an external resource.
Rel::Preload: High priority. Tells the browser "I need this file (font, script, CSS) immediately for the current page." Requires the asPreloadAs attribute.
Rel::Preconnect: Pre-negotiates a connection (DNS, TCP, TLS) to a third-party domain (like Google Fonts or an API) so the actual request is faster later.
Rel::DnsPrefetch: A lighter version of preconnect; it only resolves the domain name to an IP address.
Rel::Prefetch: Low priority. Tells the browser "The user will likely need this on the next page, so download it in the background when idle."
Rel::ModulePreload: A specialized version of preload designed specifically for JavaScript modules.
Rel::Prerender: Requests the browser to fully load and render a page in a hidden background tab for instant navigation.
SEO & Document Metadata
These help search engines like Google understand your site structure.
Rel::Canonical: Gives the preferred URL for the current document.
Rel::Alternate: Points to an alternative version of the page (e.g., a different language via hreflang, a PDF version, or an RSS feed).
Rel::Next / Rel::Prev: Indicates the relationship between pages in a paginated series (e.g., Page 1, Page 2).
Rel::Author: Links to a page about the author of the content.
Rel::License: Links to the copyright or legal license governing the page content.
Rel::Search: Links to an OpenSearch description document, allowing browsers to add your site as a search engine option.
Asset & Visual Presentation
Rel::Stylesheet: The most common value; it imports an external CSS file to style the document.
Rel::Icon: Specifies the favicon for browser tabs and bookmarks. Default
implementation is Icon
Rel::AppleTouchIcon: A specialized version used by iOS when a user "Adds to Home Screen."
Rel::Manifest: Links to a JSON file (Web App Manifest) used for Progressive Web Apps (PWAs).
Security & Social
Rel::Me: Used for "Social Graph" verification. It tells platforms like Mastodon or Gravatar, "This link proves I own this website."
Rel::Pingback: An old-school way for a server to be notified when another site links to it.
PHP version
YAML version
JSON version
NEON version
The Open Graph protocol
The Open Graph protocol enables any web page to become a rich object in
a social graph. For instance, this is used on Facebook to allow any web
page to have the same functionality as any other object on Facebook.
PHP version
YAML version
JSON version
NEON version
This site uses cookies
In order to work as intended, this site stores cookies on your device. Accepting
improves our site and provides you with personalized service. Declining results
in one cookie being placed on your device so we remember your choice.