Skip to content

Latest commit

 

History

67 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTML Page Search Engine Optimization Test Suite

Go Reference

Page prevents common page degradation scenarios, which lead to gradual loss of page ranking:

  1. Losing relevant metadata when changing HTML view templates or database models.
  2. Duplicating metadata fields on the same page.
  3. Duplicating metadata on different publicly available pages.
  4. Forgetting to enforce minimum and recommended metadata field sizes.
  5. Forgetting to enforce UTF normalization on page content.

The library works by providing a reasonable Goland test suite and a command line tool that any HTML page should pass in order to fit current search engine optimization expectations.

None of the top website fit the "best practice." This indicates that companies are not regularly testing search engine optimization in between hiring consultants.

Library Usage

When page tests run with --short flag, all external page resources are not loaded or checked.

go get -u github.com/dkotik/pageseo@latest
import (
  "bytes"
  "testing"

  "github.com/dkotik/pageseo"
)

func TestSearchEngineOptimization(t *testing.T) {
  validator := pageseo.NewStrict(
    pageseo.Requirements{
      // override requirements as needed
      Title: pageseo.NewTitleValidator(
        pageseo.StringConstraints{
          MinimumLength: 12,
          MaximumLength: pageseo.DefaultMaximumTitleLength * 4,
          Normalizer: pageseo.NomalizeLineToNFC,
        },
      ),
    },
  )

  t.Run("index.html", validator.TestReader(
    t.Name(), // identify the origin for content de-duplication
    bytes.NewReader([]byte("<html><p>index</p></html>")),
  ))

  t.Run("sitemap.html", validator.TestReader(
    t.Name(), // identify the origin for content de-duplication
    bytes.NewReader([]byte("<html><p>sitemap</p></html>")),
  ))
}

Command Line Usage

Installation

  • MacOS:
    brew tap dkotik/tap
    brew install curl pageseo
  • Debian Package: latest release
  • Linux Binary: latest release
  • Windows Binary: latest release
  • Build from source:
    go install github.com/dkotik/pageseo/cmd/pageseo@latest

Scanning

pageseo --strict --verbose --failfast=false ./**/*.html

Development Road Map

  • Provide a command line scanner that can crawl live websites.
  • Provide a command line scanner that can validate statically generated websites.
  • Unique contraint by namespace with a namespace flag for CLI.
  • Add missing social validators, as image and URL are not tested: opengraph.go:55: unknown Open Graph properties: opengraph.go:57: - og:image:height opengraph.go:57: - og:image:type opengraph.go:57: - og:image:width twitter.go:58: unknown Twitter properties: twitter.go:60: - twitter:image:alt
  • analyze fb: meta data
  • load /sitemap
  • support --json tag and redirect t.Output() writers to t.Attr()
  • Provide a service that can crawl a target at an interval, and pause at failing crawl until the issue is fixed.
  • add monitor command that rescans the website daily for SEO purity and broken links
  • Validate image sizes.
  • Validate dependencies in style sheets.

Similar Projects

About

HTML page search engine optimization test and utility suite.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages