-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add <meta> tags for Open Graph
- Loading branch information
1 parent
962fdec
commit 317d6bf
Showing
14 changed files
with
115 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,51 @@ | ||
{{- /*gotype: github.com/rynhndrcksn/go-starter-site/cmd/web.templateData*/ -}} | ||
{{define "base"}} | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<head prefix="og: https://ogp.me/ns#"> | ||
<meta charset="utf-8"> | ||
<title>{{template "title" .}} - Site</title> | ||
<title>{{ .Title }} - {{ .SiteName }}</title> | ||
|
||
<!-- Make the search engine overlords happy --> | ||
<link rel="canonical" href="{{ .CanonicalUrl }}"> | ||
<meta name="description" content="{{ .Description }}"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="keyword" content=""> | ||
|
||
<!-- Open Graph --> | ||
<meta property="og:site_name" content="{{ .SiteName }}"> | ||
<meta property="og:title" content="{{ .Title }}"> | ||
<meta property="og:description" content="{{ .Description }}"> | ||
<meta property="og:type" content="{{ .PageType }}"> | ||
<meta property="og:url" content="{{ .CanonicalUrl }}"> | ||
<meta property="og:locale" content="en_US"> | ||
<meta property="og:image" content="{{ .ImageUrl }}"> | ||
<meta property="og:image:width" content="1200"> | ||
<meta property="og:image:height" content="630"> | ||
<!-- Why no og:image:alt? Read this: https://yoast.com/developer-blog/why-we-dont-set-the-og-image-alt-tag/ --> | ||
|
||
<!-- Twitter/X--> | ||
<meta name="twitter:card" content="summary_large_image"> | ||
<meta name="twitter:title" content="{{ .Title }}"> | ||
<meta name="twitter:description" content="{{ .Description }}"> | ||
<meta name="twitter:image" content="{{ .ImageUrl }}"> | ||
<meta name="twitter:image:width" content="1200"> | ||
<meta name="twitter:image:height" content="630"> | ||
<!-- Why no twitter:image:alt? Read this: https://yoast.com/developer-blog/why-we-dont-set-the-og-image-alt-tag/ --> | ||
|
||
<link rel="icon" href="/static/favicon.svg" type="image/svg+xml"> | ||
<link rel="stylesheet" href="/static/css/main.css"> | ||
<link rel="shortcut icon" href="/static/img/favicon.ico" type="image/x-icon"> | ||
</head> | ||
<body> | ||
<header> | ||
<h1><a href='/'>Home</a></h1> | ||
</header> | ||
{{template "nav" .}} | ||
{{template "header" .}} | ||
<main> | ||
{{with .Flash}} | ||
<div class="flash">{{.}}</div> | ||
{{end}} | ||
{{template "main" .}} | ||
</main> | ||
{{template "footer" .}} | ||
<script src="/static/js/main.js" type="text/javascript" async defer></script> | ||
<script src="/static/js/main.js" async defer></script> | ||
</body> | ||
</html> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{{define "nav-link"}} | ||
<a href="{{.Link}}">{{.Text}}</a> | ||
<a href="{{ .Link }}" class="{{ .Classes }}">{{ .Text }}</a> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
{{define "title"}}Not Found{{end}} | ||
|
||
{{define "main"}} | ||
<p>We were unable to find what you were looking for! Want to go back <a href="/">home</a>?</p> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
{{define "title"}}Server Error{{end}} | ||
|
||
{{define "main"}} | ||
<p>We encountered an unexpected error! Want to go back <a href="/">home</a>?</p> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{define "main"}} | ||
<h1>There's nothing to read about yet!</h1> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
{{define "title"}}Home{{end}} | ||
|
||
{{define "main"}} | ||
<h1>There's nothing to see here yet!</h1> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{{define "footer"}} | ||
<footer> | ||
<div>Powered by <a href="https://go.dev/" target="_blank">Go</a> in {{.CurrentYear}}</div> | ||
<div>Powered by <a href="https://go.dev/" target="_blank">Go</a> in {{ .CurrentYear }}</div> | ||
</footer> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{{define "header"}} | ||
<header> | ||
{{template "nav" .}} | ||
</header> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
{{define "nav"}} | ||
<nav> | ||
<div> | ||
{{template "nav-link" (props "Link" "/" "Text" "Home")}} | ||
{{template "nav-link" (props "Link" "/about" "Text" "About")}} | ||
</div> | ||
{{template "nav-link" (props "Link" "/" "Text" "Home" "Classes" "home")}} | ||
{{template "nav-link" (props "Link" "/about" "Text" "About" "Classes" "")}} | ||
</nav> | ||
{{end}} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.