content,internal: add description and title to unit page

Adds title and description to the legacy and new layout
unit pages. MetaDescription is updated to be the synopsis
of the documentation page.

Change-Id: Ie214229fa61075b75bb69d0eadb8060906da2519
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/326812
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/content/static/html/pages/unit.tmpl b/content/static/html/pages/unit.tmpl
index 875446f..4ea2eac 100644
--- a/content/static/html/pages/unit.tmpl
+++ b/content/static/html/pages/unit.tmpl
@@ -4,6 +4,10 @@
   license that can be found in the LICENSE file.
 -->
 
+{{define "title"}}<title>{{.Title}} · pkg.go.dev</title>{{end}}
+
+{{define "description"}}{{.MetaDescription}}{{end}}
+
 {{define "pre-content"}}
   <link href="/static/css/stylesheet.css?version={{.AppVersionLabel}}" rel="stylesheet">
   <link href="/static/css/unit.css?version={{.AppVersionLabel}}" rel="stylesheet">
diff --git a/content/static/unit/unit.tmpl b/content/static/unit/unit.tmpl
index 59b3a07..a17d5f6 100644
--- a/content/static/unit/unit.tmpl
+++ b/content/static/unit/unit.tmpl
@@ -4,6 +4,10 @@
   license that can be found in the LICENSE file.
 -->
 
+{{define "title"}}<title>{{.Title}} · pkg.go.dev</title>{{end}}
+
+{{define "description"}}{{.MetaDescription}}{{end}}
+
 {{define "pre-content"}}
   <link href="/static/unit/unit.css?version={{.AppVersionLabel}}" rel="stylesheet">
   {{block "main-styles".}}{{end}}
diff --git a/internal/frontend/unit.go b/internal/frontend/unit.go
index c9f7051..7088a51 100644
--- a/internal/frontend/unit.go
+++ b/internal/frontend/unit.go
@@ -10,7 +10,6 @@
 	"errors"
 	"fmt"
 	"net/http"
-	"strconv"
 	"strings"
 	"time"
 
@@ -218,7 +217,7 @@
 	page.Details = d
 	main, ok := d.(*MainDetails)
 	if ok {
-		page.MetaDescription = metaDescription(strconv.Itoa(main.ImportedByCount))
+		page.MetaDescription = metaDescription(main.DocSynopsis)
 	}
 	s.servePage(ctx, w, tabSettings.TemplateName, page)
 	return nil