feat(social): supports rel-me links
This commit is contained in:
parent
cf36d7daa9
commit
d7598a843e
5 changed files with 14 additions and 12 deletions
|
@ -21,18 +21,21 @@ This font must be compressed by [Woff2](https://en.wikipedia.org/wiki/Web_Open_F
|
||||||
### Main config
|
### Main config
|
||||||
You can create a sample config with the flag `-generate-json-config` (which generates a JSON config) or with
|
You can create a sample config with the flag `-generate-json-config` (which generates a JSON config) or with
|
||||||
`-generate-toml-config` (which generates a TOML config).
|
`-generate-toml-config` (which generates a TOML config).
|
||||||
A JSON schema is available for json configs.
|
A JSON schema is available for JSON configs.
|
||||||
|
|
||||||
The config does not depend on the markup language: a field `foo` will being named `foo` for JSON and TOML.
|
The config does not depend on the markup language: a field `foo` will being named `foo` for JSON and TOML.
|
||||||
The TOML format is used in this section.
|
The TOML format is used in this section.
|
||||||
|
|
||||||
The root is defining the background image, the description, the file's path to the legal pages and the path to
|
The root is defining the background image, the description, the file's path to the legal pages, the path to
|
||||||
the configs of custom pages.
|
the configs of custom pages and a list of all your ["rel-me"](https://microformats.org/wiki/rel-me) links.
|
||||||
|
(The "rel-me" links are required to
|
||||||
|
[verify a link on your Mastodon account](https://docs.joinmastodon.org/user/profile/#verification), for example.)
|
||||||
```toml
|
```toml
|
||||||
image = "wallpaper.webp"
|
image = "wallpaper.webp"
|
||||||
description = "I am a beautiful description!"
|
description = "I am a beautiful description!"
|
||||||
legal = "legal.html"
|
legal = "legal.html"
|
||||||
custom_pages = ["custom.toml"]
|
custom_pages = ["custom.toml"]
|
||||||
|
rel_me_links = ["https://foo.example.org/@bar"]
|
||||||
```
|
```
|
||||||
The path is relative to the execution of the binary.
|
The path is relative to the execution of the binary.
|
||||||
If you are using Docker, please use a static path.
|
If you are using Docker, please use a static path.
|
||||||
|
|
|
@ -160,6 +160,9 @@
|
||||||
},
|
},
|
||||||
"custom_pages": {
|
"custom_pages": {
|
||||||
"type": "array"
|
"type": "array"
|
||||||
|
},
|
||||||
|
"rel_me_links": {
|
||||||
|
"type": "array"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
|
10
data.go
10
data.go
|
@ -11,15 +11,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
TitleContentType = "title"
|
|
||||||
SubtitleContentType = "subtitle"
|
|
||||||
ParagraphContentType = "paragraph"
|
|
||||||
ListContentType = "list"
|
|
||||||
OrderedListContentType = "ordered_list"
|
|
||||||
ButtonsContentType = "links"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ConfigData interface {
|
type ConfigData interface {
|
||||||
GetTextColor() template.CSS
|
GetTextColor() template.CSS
|
||||||
GetBackground() template.CSS
|
GetBackground() template.CSS
|
||||||
|
@ -34,6 +25,7 @@ type Config struct {
|
||||||
Color *Color `json:"colors" toml:"colors"`
|
Color *Color `json:"colors" toml:"colors"`
|
||||||
Links []*Link `json:"links" toml:"links"`
|
Links []*Link `json:"links" toml:"links"`
|
||||||
Legal string `json:"legal" toml:"legal"`
|
Legal string `json:"legal" toml:"legal"`
|
||||||
|
RelMeLinks []string `json:"rel_me_links" toml:"rel_me_links"`
|
||||||
CustomPages []string `json:"custom_pages" toml:"custom_pages"`
|
CustomPages []string `json:"custom_pages" toml:"custom_pages"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
main.go
1
main.go
|
@ -174,6 +174,7 @@ func generateConfigFile(isToml bool) {
|
||||||
},
|
},
|
||||||
Legal: "legal.html",
|
Legal: "legal.html",
|
||||||
CustomPages: []string{"custom.json"},
|
CustomPages: []string{"custom.json"},
|
||||||
|
RelMeLinks: []string{"https://foo.example.org/@bar"},
|
||||||
}
|
}
|
||||||
var b []byte
|
var b []byte
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
.links { {{ .Data.Color.Button.GetBackground }}{{ .Data.Color.Button.GetTextColor }} }
|
.links { {{ .Data.Color.Button.GetBackground }}{{ .Data.Color.Button.GetTextColor }} }
|
||||||
</style>
|
</style>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ range .Data.RelMeLinks }}
|
||||||
|
<link rel="me" href="{{ . }}" />
|
||||||
|
{{ end }}
|
||||||
</head>
|
</head>
|
||||||
<body style="{{ .Data.GetBackgroundImage }}{{ .Data.GetTextColor }}">
|
<body style="{{ .Data.GetBackgroundImage }}{{ .Data.GetTextColor }}">
|
||||||
<div class="center">
|
<div class="center">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue