diff options
| author | Dmitri Shuralyov <dmitshur@golang.org> | 2024-08-14 20:10:29 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-08-16 19:56:31 +0000 |
| commit | d43f0ec556781ce4f96941c94e55feac52da9ec9 (patch) | |
| tree | 5c5f65685c10afe09e25f7e4663234b97213dd65 /cmd | |
| parent | 702685aefd7d51b78a8131f8fddd077f499e01c4 (diff) | |
| download | go-x-website-d43f0ec556781ce4f96941c94e55feac52da9ec9.tar.xz | |
internal/blog: populate author names in feeds
Go blog posts have metadata like:
by:
- Author Name
- Maybe Another Author
Those YAML lists were decoded into a slice of empty interfaces, each
holding a string, and all that was being ignored. Update it to parse
the []any type of p["by"] and to return an error if there aren't any
authors. There are only 2 existing blog posts that cause such errors,
but they're very old and can be ignored (or updated if needed).
There's probably more that can be done, like having one <author> XML
item per 'by' item in the YAML/JSON metadata of blog posts, but this
is a reasonable step forward.
For golang/go#68869.
Change-Id: I7b97a09b006bacf4835442a749cb0e467c7dbb47
Reviewed-on: https://go-review.googlesource.com/c/website/+/605537
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/golangorg/testdata/blog.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cmd/golangorg/testdata/blog.txt b/cmd/golangorg/testdata/blog.txt index e3cd2616..aea168d5 100644 --- a/cmd/golangorg/testdata/blog.txt +++ b/cmd/golangorg/testdata/blog.txt @@ -41,6 +41,7 @@ redirect == /blog/ GET https://go.dev/blog/feed.atom header Content-Type == application/atom+xml; charset=utf-8 body contains <feed xmlns="http://www.w3.org/2005/Atom"><title>The Go Blog</title> +body !contains <author><name></name></author> GET https://go.dev/blog/.json header Content-Type == application/json; charset=utf-8 |
