Adds social media meta tags and new param for featured images
This commit is contained in:
parent
830ad5392b
commit
cde5d340bd
3 changed files with 21 additions and 3 deletions
|
@ -129,6 +129,14 @@ These posts are rendered slightly different with an → to signify that it is re
|
|||
|
||||

|
||||
|
||||
#### Specifying a featured image for social media
|
||||
|
||||
Sometimes you want to feature an image as your featured image that will display when linking your post in social media. This can be done by including the `feature` parameter on your individual post. Note you don't need to put the URL, just the path to the image without a leading `/`
|
||||
|
||||
```
|
||||
feature: "assets/posts/20240219/image.jpg"
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
| Variable | What value? | Required |
|
||||
|
|
|
@ -6,17 +6,27 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="author" content="{{ with .Site.Author.firstname }}{{ . }}{{ end }} {{ with .Site.Author.lastname }}{{ . }}{{ end }}">
|
||||
<meta name="description" content="{{ with .Site.Params.description }}{{ . }}{{ end }}">
|
||||
{{ hugo.Generator }}
|
||||
|
||||
{{ $siteTitle := .Site.Title }} {{ $title := $siteTitle }}{{ if .IsPage }}{{ $title = .Title }}
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:title" content="{{ $title }}">
|
||||
{{ if .Param "feature" }}<meta property="og:image" content="{{ .Site.BaseURL }}{{ .Params.feature }}">{{ end }}
|
||||
<meta property="og:url" content="{{ .Page.Permalink }}">
|
||||
<meta property="og:description" content="{{ .Summary }}">
|
||||
<meta property="og:site_name" content="@{{ .Site.Author.handle }}’s {{ .Site.Title }}">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
{{ end }}
|
||||
{{ hugo.Generator }}
|
||||
{{ $.Scratch.Add "title" .Site.Title }}
|
||||
<title>{{ with .Title }}{{ if ne . ($.Scratch.Get "title") }}{{ . }} · {{ end }}{{ end }}@{{ .Site.Author.handle }}’s {{ .Site.Title }}</title>
|
||||
|
||||
<link rel="stylesheet" href="{{.Site.BaseURL}}css/weblog.css" media="screen" charset="utf-8" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/1.2.14/css/lightgallery.min.css" type="text/css" />
|
||||
|
||||
{{ partial "custom_stylesheets.html" . }}
|
||||
|
||||
{{ if .Site.Params.rssenabled }}
|
||||
<link href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}" rel="alternate" type="application/rss+xml" title="{{.Site.Title}}" />
|
||||
<link href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}" rel="alternate" type="application/rss+xml" title="{{.Site.Title}}" />
|
||||
{{ end }}
|
||||
</head>
|
||||
<body class="site">
|
||||
|
|
|
@ -17,7 +17,7 @@ iweblog.application = function() {
|
|||
cnt++;
|
||||
});
|
||||
|
||||
$('#photos').html(htmlString);
|
||||
$('#photos').html(htmlString);
|
||||
$('#photos').lightGallery();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue