Package htmlmeta provides tool for working with the HTML element, for the Go programming language.
Find a file
2025-09-08 05:11:44 -07:00
extractbyname.go correction 2025-09-08 05:11:44 -07:00
extractbyname_test.go correction 2025-09-08 05:11:44 -07:00
go.mod go.* 2025-09-08 05:03:49 -07:00
go.sum go.* 2025-09-08 05:03:49 -07:00
LICENSE initial commits 2025-09-08 04:03:06 -07:00
README.md initial commits 2025-09-08 04:13:01 -07:00

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

GoDoc

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