← Tool directory
TOOL PROFILE

goquery

Extract titles and canonical links from saved HTML with CSS selectors in a Go audit script.

Open source

Community support

Upvotes come from SearchEngineAnswer members. GitHub stars and reader reviews are counted separately.

Claim this tool if you maintain it.

Best for
Crawling
Setup required
Use Go 1.26 or later for goquery 1.14 and run the example inside a Go module.
Costs to check
BSD-3-Clause library. The example processes a local file and requires no account or paid service.
License in catalog
BSD-3-Clause

GitHub repository

GitHub stars
14,995
Forks
950
Last push
2026-11-15
Primary language
Go

GitHub snapshot from . Stars count GitHub bookmarks. Reader ratings appear separately below.

How to install goquery

  1. Initialize a scratch project with go mod init example.com/head-audit.
    go get github.com/PuerkitoBio/goquery@v1.14.0
  2. Add goquery to the module with the installation command below. Save the example code as main.go.

First tutorial for goquery

  1. Save a small HTML document as page.html with the title Audit fixture and one canonical link to https://example.com/guide/.
    package main
    
    import (
        "fmt"
        "log"
        "os"
    
        "github.com/PuerkitoBio/goquery"
    )
    
    func main() {
        file, err := os.Open("page.html")
        if err != nil {
            log.Fatal(err)
        }
        defer file.Close()
    
        doc, err := goquery.NewDocumentFromReader(file)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Title:", doc.Find("title").First().Text())
        links := doc.Find("link[rel='canonical']")
        fmt.Println("Canonical count:", links.Length())
        links.Each(func(_ int, link *goquery.Selection) {
            fmt.Println(link.AttrOr("href", "(missing href)"))
        })
    }
  2. Run go run . and check that the output shows the title, a canonical count of one and the expected URL.
  3. Add a second canonical link to a different URL and rerun the script. It should report two matches so both declarations can be investigated.

Documentation reviewed on November 20, 2026. The tutorial is a proposed check with illustrative files and URLs.

Official installation and usage documentation ↗

Where goquery fits

Choose goquery when an existing Go audit needs to read metadata from HTML snapshots in a repeatable way.

When to choose another tool
Use a browser capture when the title or canonical is added by client-side code after the initial document loads.
First evaluation
Use two saved fixtures with identical titles. Give one a single canonical and give the other two conflicting canonical links.
How to interpret the result
Compare the candidate count and values with the fixture. Treat a missing or multiple declaration as a review item and verify the response URL and headers separately.

Reviews and discussion

Reader reviews

Be the first to share your experience with this tool.

Discussion

Ask a question or share a setup tip.

Write a review or join the discussion

Reviews should describe your own experience. All submissions are moderated.

Flag an outdated detail

Include the field that needs updating and a source link. Copy your draft, then use the corrections policy to contact the editorial team.