hugo: convert hugo-social-metadata to a Hugo module [deploy][staging]
This commit is contained in:
parent
a9a780e859
commit
f8d04def7a
|
@ -1,13 +1,17 @@
|
|||
baseurl = "https://msfjarvis.dev/"
|
||||
languageCode = "en-us"
|
||||
title = "Harsh Shandilya"
|
||||
theme = ["hugo-social-metadata", "ezhil"]
|
||||
theme = ["github.com/msfjarvis/hugo-social-metadata", "ezhil"]
|
||||
pygmentsstyle = "tango"
|
||||
pygmentscodefences = true
|
||||
pygmentscodefencesguesssyntax = true
|
||||
author = "Harsh Shandilya"
|
||||
ignoreErrors = ["error-remote-getjson"]
|
||||
|
||||
[module]
|
||||
[[module.imports]]
|
||||
path = "github.com/msfjarvis/hugo-social-metadata"
|
||||
|
||||
[params]
|
||||
description = "Android developer, Kotlin fanatic and wannabe Rustacean"
|
||||
subtitle = "Android developer, Kotlin fanatic and wannabe Rustacean"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module github.com/msfjarvis/msfjarvis.dev
|
||||
|
||||
go 1.16
|
||||
|
||||
require github.com/msfjarvis/hugo-social-metadata v1.0.0 // indirect
|
|
@ -0,0 +1,2 @@
|
|||
github.com/msfjarvis/hugo-social-metadata v1.0.0 h1:mfLnus8iznPGiyFkJC93eCWr1PrdiNyv2BSONX1ZQVg=
|
||||
github.com/msfjarvis/hugo-social-metadata v1.0.0/go.mod h1:VfkrQTa9Gvdja58swLlBZz2/7ZEoj5nk9xt0pJAhfVo=
|
|
@ -1,20 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 Harsh Shandilya
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,43 +0,0 @@
|
|||
# hugo-social-metadata
|
||||
|
||||
## About
|
||||
|
||||
This is a [Hugo](https://gohugo.io) theme component that automatically generates metadata complying to [The Open Graph Protocol](https://ogp.me/) as well as [Twitter Cards](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started). This is **NOT** a standalone theme and must not be treated as such.
|
||||
|
||||
## Usage
|
||||
|
||||
1. Add the hugo-social-metadata repository as a submodule to be able to get upstream changes later `git submodule add https://github.com/msfjarvis/hugo-social-metadata.git themes/hugo-social-metadata`
|
||||
|
||||
2. Start off by configuring a few things in your `config.toml` (or equivalent file depending on whether you use YAML or JSON). These will be picked up by the theme component and used to provide metadata for the site.
|
||||
|
||||
```toml
|
||||
[params]
|
||||
description = "A description for your awesome website goes here"
|
||||
keywords = "some, keywords, that, describe, your, content"
|
||||
twitterUsername = "@your_twitter_username"
|
||||
socialImage = "path/to/the/twitter/card/image"
|
||||
```
|
||||
|
||||
3. Include the `hugo-social-metadata` theme as the leftmost element of the theme list variable in your config file. For `config.toml`, it will look something like this:
|
||||
|
||||
```toml
|
||||
theme = ["hugo-social-metadata", "hyde"]
|
||||
```
|
||||
|
||||
4. Include the `social_metadata.html` partial in your `head.html` like so: `{{ partial "social_metadata.html" . }}`.
|
||||
|
||||
## Additional customizations
|
||||
|
||||
You can customize some of the generated metadata on a per-page basis. Setting `description`, `socialImage` or `tags` in the frontmatter will override the defaults loaded from the main config file.
|
||||
|
||||
```markdown
|
||||
+++
|
||||
description = "A nice description for this blogpost"
|
||||
socialImage = "path/to/an/image/that/describes/this/post/best"
|
||||
tags = ["this", "blog", "rocks!"]
|
||||
+++
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Check out the [LICENSE](/LICENSE) file in the root of this repository.
|
|
@ -1,3 +0,0 @@
|
|||
module github.com/msfjarvis/hugo-social-metadata
|
||||
|
||||
go 1.15
|
|
@ -1,40 +0,0 @@
|
|||
<!-- Configure meta and title tags -->
|
||||
<meta property="og:type" content="website" />
|
||||
{{ if .Site.Params.TwitterCardType }}
|
||||
<meta name="twitter:card" content="{{ .Site.Params.TwitterCardType }}" key="twcard" />
|
||||
{{ else }}
|
||||
<meta name="twitter:card" content="summary_large_image" key="twcard" />
|
||||
{{ end }}
|
||||
{{ if .Site.Params.TwitterUsername }}
|
||||
<meta name="twitter:site" content="{{ .Site.Params.TwitterUsername }}" key="twhandle" />
|
||||
{{ end }}
|
||||
{{ if .IsHome }}
|
||||
<title>{{ .Site.Title }}</title>
|
||||
<meta name="description" content="{{ $.Site.Params.description }}" />
|
||||
<meta name="keywords" content="{{ $.Site.Params.Keywords }}" />
|
||||
<meta property="og:url" content="{{ .Site.BaseURL }}" key="ogurl" />
|
||||
<meta property="og:title" content="{{ .Site.Title }}" key="ogtitle" />
|
||||
<meta name="og:description" content="{{ $.Site.Params.description }}" key="ogdesc" />
|
||||
{{ else }}
|
||||
<title>{{ .Title }} · {{ .Site.Title }}</title>
|
||||
<meta name="description" content="{{ .Description }}" />
|
||||
{{ if .Params.tags }}
|
||||
<meta name="keywords" content="{{ range .Params.tags }}{{ . }},{{ end }}" />
|
||||
{{ else }}
|
||||
<meta name="keywords" content="{{ $.Site.Params.Keywords }}" />
|
||||
{{ end }}
|
||||
<meta property="og:url" content="{{ .Permalink }}" />
|
||||
<meta property="og:title" content="{{ .Title }} · {{ .Site.Title }}" />
|
||||
{{ if .Description }}
|
||||
<meta name="og:description" content="{{ .Description }}" />
|
||||
{{ else }}
|
||||
<meta name="og:description" content="{{ $.Site.Params.description }}" />
|
||||
{{ end }}
|
||||
<meta name="twitter:url" content="{{ .Permalink }}" />
|
||||
{{ if .Params.SocialImage }}
|
||||
<meta property="og:image" content="{{ .Site.BaseURL }}{{ .Params.SocialImage }}" key="ogimage" />
|
||||
{{ else }}
|
||||
<meta property="og:image" content="{{ .Site.BaseURL}}{{ .Site.Params.SocialImage }}" key="ogimage" />
|
||||
{{ end }}
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
{{ end }}
|
|
@ -1,12 +0,0 @@
|
|||
name = "Hugo Social Metadata"
|
||||
license = "MIT"
|
||||
licenselink = "https://github.com/msfjarvis/hugo-social-metadata/blob/main/LICENSE"
|
||||
description = "Hugo theme component that automatically generates metadata for Twitter's cards and Facebook's Open Graph protocol"
|
||||
homepage = "http://example.com/"
|
||||
tags = ["component", "social metadata"]
|
||||
features = ["twitter cards", "open graph protocol"]
|
||||
min_version = "0.41"
|
||||
|
||||
[author]
|
||||
name = "Harsh Shandilya"
|
||||
homepage = "https://msfjarvis.dev"
|
Loading…
Reference in New Issue