Package htmlmeta provides tool for working with the HTML element, for the Go programming language.
- Go 100%
| extractbyname.go | ||
| extractbyname_test.go | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| README.md | ||
go-htmlmeta
Package htmlmeta provides tool for working with the HTML <meta> element, for the Go programming language.
Documention
Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-htmlmeta
Example
Here is an example of getting the content of all the <meta> elements with name="category":
import "codeberg.org/reiver/go-htmlmeta"
// ...
var html string = `<html>
<head>
<title>Hi!</title>
<meta name="category" content="apple" />
<meta name="category" content="banana" />
<meta name="category" content="cherry" />
<meta name="published" content="2025-09-08" />
</head>
<body>
<h1>Hello World!</h1>
<p>
How are you?
</p>
</body>
</html>
`
categories := htmlmeta.ExtractByName(html, "category")
// categories == []string{"apple","banana","cherry"}
Import
To import package htmlmeta use import code like the following:
import "codeberg.org/reiver/go-htmlmeta"
Installation
To install package htmlmeta do the following:
GOPROXY=direct go get codeberg.org/reiver/go-htmlmeta
Author
Package htmlmeta was written by Charles Iliya Krempeaux