Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions content/-/_content.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- $root := site.Params.goVanityRoot -}}
{{- if not $root -}}
{{- errorf "params.goVanityRoot must be configured" -}}
{{- end -}}

{{- range $name, $target := site.Data.go_packages.packages -}}
{{- if not (findRE `^[A-Za-z0-9][A-Za-z0-9._-]*$` $name) -}}
{{- errorf "invalid Go vanity package name %q" $name -}}
{{- end -}}
{{- if not $target.vcs -}}
{{- errorf "Go vanity package %q has no vcs" $name -}}
{{- end -}}
{{- if not $target.repository -}}
{{- errorf "Go vanity package %q has no repository" $name -}}
{{- end -}}

{{- $importPath := printf "%s/%s" $root $name -}}
{{- $params := dict
"import_path" $importPath
"repository" $target.repository
"vcs" $target.vcs
-}}
{{- $page := dict
"kind" "page"
"params" $params
"path" $name
"title" $importPath
"type" "go-package"
-}}
{{- $.AddPage $page -}}
{{- end -}}
6 changes: 6 additions & 0 deletions content/-/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Go packages
build:
list: never
render: never
---
7 changes: 7 additions & 0 deletions data/go_packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
packages:
gstream:
vcs: git
repository: https://github.com/mortezaPRK/gstream
kmir:
vcs: git
repository: https://github.com/mortezaPRK/kmir
1 change: 1 addition & 0 deletions hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ permalinks:
posts: /posts/:year/:month/:title/

params:
goVanityRoot: go.mortz.dev/-
enableSharingButtons: true
logo:
logoMark: ">"
Expand Down
13 changes: 13 additions & 0 deletions layouts/go-package/single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="go-import" content="{{ index .Params "import_path" }} {{ .Params.vcs }} {{ .Params.repository }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="refresh" content="0; url={{ .Params.repository }}">
<title>{{ .Title }}</title>
</head>
<body>
<p><a href="{{ .Params.repository }}">{{ .Params.repository }}</a></p>
</body>
</html>
Loading