Slide 1

Slide 1 text

The XPath to Discovery speakerdeck.com/nathanless @NathanLess Jonathan Moore

Slide 2

Slide 2 text

What I do I solve problems About me Technical SEO Consultant

Slide 3

Slide 3 text

Critiquing other people’s websites is easy #BrightonSEO @nathanless

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

#BrightonSEO @nathanless

Slide 10

Slide 10 text

HOME CATEGORY LIST PRODUCT #BrightonSEO @nathanless

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

12 #BrightonSEO @nathanless

Slide 13

Slide 13 text

XPath is a query language. We can use it to select elements from an XML or HTML document. #BrightonSEO @nathanless

Slide 14

Slide 14 text

XPath is mainly used in XSLT but can also be used as a much more powerful way of navigating through the DOM. Source: https://developer.mozilla.org/en-US/docs/Web/XPath #BrightonSEO @nathanless

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Control + Shift + C 16 #BrightonSEO @nathanless

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Control + F 18 #BrightonSEO @nathanless

Slide 19

Slide 19 text

#BrightonSEO @nathanless

Slide 20

Slide 20 text

Hello World!

Attribute and Value Text Content Opening Tag Closing Tag #BrightonSEO @nathanless

Slide 21

Slide 21 text

// a 21 Axis Step #BrightonSEO @nathanless

Slide 22

Slide 22 text

#BrightonSEO @nathanless

Slide 23

Slide 23 text

#BrightonSEO @nathanless

Slide 24

Slide 24 text

#BrightonSEO @nathanless

Slide 25

Slide 25 text

devhints.io/xpath

Slide 26

Slide 26 text

#BrightonSEO @nathanless

Slide 27

Slide 27 text

#BrightonSEO @nathanless

Slide 28

Slide 28 text

// Fundamentals

Slide 29

Slide 29 text

// footer // a 29 Axis Step Axis Step // Descendants #BrightonSEO @nathanless

Slide 30

Slide 30 text

#BrightonSEO @nathanless

Slide 31

Slide 31 text

//meta[@name="description"] 31 // Exact Match #BrightonSEO @nathanless

Slide 32

Slide 32 text

#BrightonSEO @nathanless

Slide 33

Slide 33 text

/ / m e t a [ c o n t a i n s ( @ p r o p e r t y , " o g : " ) ] 33 // Contains #BrightonSEO @nathanless

Slide 34

Slide 34 text

#BrightonSEO @nathanless

Slide 35

Slide 35 text

/ / s c r i p t [ @ s r c a n d @ d e f e r ] 35 // And #BrightonSEO @nathanless

Slide 36

Slide 36 text

#BrightonSEO @nathanless

Slide 37

Slide 37 text

/ / l i n k [ c o n t a i n s ( @ r e l , " n e x t " ) o r c o n t a i n s ( @ r e l , " p r e v " ) ] 37 // Or #BrightonSEO @nathanless

Slide 38

Slide 38 text

#BrightonSEO @nathanless

Slide 39

Slide 39 text

/ / i m g [ n o t ( @ a l t ] 39 // Negation #BrightonSEO @nathanless

Slide 40

Slide 40 text

#BrightonSEO @nathanless

Slide 41

Slide 41 text

//a[ cont ains (tex t(), "for sal e in May fair ")] 41 // Text #BrightonSEO @nathanless

Slide 42

Slide 42 text

#BrightonSEO @nathanless

Slide 43

Slide 43 text

// Combinations

Slide 44

Slide 44 text

//link[@rel="alternate"] /@hreflang 44 // Href Lang #BrightonSEO @nathanless

Slide 45

Slide 45 text

#BrightonSEO @nathanless

Slide 46

Slide 46 text

/ / * / @ * [ s t a r t s - w i t h ( n a m e ( ) , " d a t a - " ) ] 46 // Data Attributes #BrightonSEO @nathanless

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

/ / l i n k [ c o n t a i n s ( @ r e l , " d n s - p r e f e t c h " ) o r c o n t a i n s ( @ r e l , " p r e c o n n e c t " ) o r c o n t a i n s ( @ r e l , " p r e l o a d " ) o r c o n t a i n s ( @ r e l , " p r e f e t c h " ) o r c o n t a i n s ( @ r e l , " p r e r e n d e r " ) ] 48 // Resource Hints #BrightonSEO @nathanless

Slide 49

Slide 49 text

#BrightonSEO @nathanless

Slide 50

Slide 50 text

/ / * [ s e l f : : h 1 o r s e l f : : h 2 o r s e l f : : h 3 o r s e l f : : h 4 o r s e l f : : h 5 o r s e l f : : h 6 ] 50 // Header Elements #BrightonSEO @nathanless

Slide 51

Slide 51 text

#BrightonSEO @nathanless

Slide 52

Slide 52 text

/ / h e a d / * [ s e l f : : i m g o r s e l f : : i f r a m e o r s e l f : : n o s c r i p t ] 52 // Invalid tags #BrightonSEO @nathanless

Slide 53

Slide 53 text

#BrightonSEO @nathanless

Slide 54

Slide 54 text

//picture/img 54 // Picture Element Images #BrightonSEO @nathanless

Slide 55

Slide 55 text

#BrightonSEO @nathanless

Slide 56

Slide 56 text

/ / i m g [ n o t ( c o n t a i n s ( @ l o a d i n g , " l a z y " ) o r c o n t a i n s ( @ c l a s s , " l a z y " ) o r c o n t a i n s ( @ c l a s s , " l a z y l o a d e d " ) ) ] 56 // Image Lazy Loading #BrightonSEO @nathanless

Slide 57

Slide 57 text

#BrightonSEO @nathanless

Slide 58

Slide 58 text

//a[substring(@href, string-length(@href) = '/')] 58 // URLs with trailing slash #BrightonSEO @nathanless

Slide 59

Slide 59 text

#BrightonSEO @nathanless

Slide 60

Slide 60 text

//a[not(substring(@href, string-length(@href)) = '/')] 60 // URLs without trailing slash #BrightonSEO @nathanless

Slide 61

Slide 61 text

#BrightonSEO @nathanless

Slide 62

Slide 62 text

// Scale

Slide 63

Slide 63 text

#BrightonSEO @nathanless

Slide 64

Slide 64 text

#BrightonSEO @nathanless

Slide 65

Slide 65 text

#BrightonSEO @nathanless

Slide 66

Slide 66 text

#BrightonSEO @nathanless

Slide 67

Slide 67 text

//count() 67 // Count #BrightonSEO @nathanless

Slide 68

Slide 68 text

#BrightonSEO @nathanless

Slide 69

Slide 69 text

//boolean() 69 // Boolean #BrightonSEO @nathanless

Slide 70

Slide 70 text

#BrightonSEO @nathanless

Slide 71

Slide 71 text

#BrightonSEO @nathanless

Slide 72

Slide 72 text

// Takeaways

Slide 73

Slide 73 text

Find the root cause #BrightonSEO @nathanless

Slide 74

Slide 74 text

Master the fundamentals #BrightonSEO @nathanless

Slide 75

Slide 75 text

Use combinations #BrightonSEO @nathanless

Slide 76

Slide 76 text

Have fun and experiment #BrightonSEO @nathanless

Slide 77

Slide 77 text

#BrightonSEO @nathanless Presentation Examples

Slide 78

Slide 78 text

Thank You #BrightonSEO @nathanless