Created
April 21, 2023 08:57
-
-
Save jonathanmooredigital/8e3423b680751ecde7425cd2e7c4d671 to your computer and use it in GitHub Desktop.
April 2023 Brighton SEO Xpath Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
======================================================================== | |
Brighton SEO April 2023 - The XPath to Discovery | |
https://www.linkedin.com/in/moorejonathan/ | |
https://twitter.com/nathanless | |
======================================================================== | |
*/ | |
Decendants | |
//footer//a | |
Exact match | |
//meta[@name="description"] | |
Contains | |
//meta[contains(@property,"og:")] | |
And | |
//script[@src and @defer] | |
Or | |
//link[contains(@rel, "next") or contains(@rel, "prev")] | |
Negation | |
//img[not(@alt] | |
Text | |
//a[contains(text(),"for sale in Mayfair")] | |
Href lang atributes | |
//link[@rel="alternate"]/@hreflang | |
Data attributes | |
//*/@*[starts-with(name(),"data-")] | |
Resource hints | |
//link[ contains(@rel, "dns-prefetch") or contains(@rel, "preconnect") or contains(@rel, "preload") or contains(@rel, "prefetch") or contains(@rel, "prerender")] | |
Header elements | |
//*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6] | |
Invalid <head> tags | |
//head/*[self::img or ::iframe or self::noscript] | |
Picture elements | |
//picture/img | |
Images not lazy loaded | |
//img[not(contains(@loading,"lazy" or contains(@class, "lazy") or contains(@class, "lazyloaded"))] | |
URLs with trailing slash | |
//a[substring(@href, string-length(@href) = '/')] | |
URLs without trailing slash | |
//a[not(substring(@href, string-length(@href)) = '/')] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment