diff --git a/data.yaml b/data.yaml index cfa91f9..e8f2baf 100644 --- a/data.yaml +++ b/data.yaml @@ -3,6 +3,7 @@ intro: | I'm always happy to chat so feel free to drop me an email at hello@marcusnoble.co.uk, or using any of the other social links below. social: - url: https://marcusnoble.co.uk + slug: "/blog" title: My articles on my Blog content: | @@ -10,27 +11,32 @@ social: Blog - url: "mailto:hello@marcusnoble.co.uk" + slug: "" title: Email me content: | Email - - url: https://marcusnoble.co.uk - title: My articles on my Blog + - url: https://cv.marcusnoble.co.uk + slug: "/cv" + title: My CV content: | C.V. - url: https://www.github.com/AverageMarcus - title: AverageMarcus on GitHubBlog + slug: "/github" + title: AverageMarcus on GitHub content: | GitHub - url: https://twitter.com/Marcus_Noble_ - title: "@Marcus_Noble_ on TwitterBlog" + slug: "/twitter" + title: "@Marcus_Noble_ on Twitter" content: | Twitter - url: https://k8s.social/@Marcus - title: "@marcus@k8s.social on MastodonBlog" + slug: "/mastodon" + title: "@marcus@k8s.social on Mastodon" content: | @@ -38,7 +44,8 @@ social: Mastodon - url: https://www.linkedin.com/in/marcusnoble/ - title: Connect with me on LinkedinBlog + slug: "/linkedin" + title: Connect with me on Linkedin content: | @@ -48,18 +55,21 @@ social: LinkedIn - url: https://noti.st/averagemarcus - title: View my previous talks on NotistBlog + slug: "/notist" + title: View my previous talks on Notist content: | Notist - url: https://youtube.com/playlist?list=PLT41C0Ggz5wa66-AU5xapbOuzkUKUPLzi - title: My appearances on YouTubeBlog + slug: "/youtube" + title: My appearances on YouTube content: | YouTube - url: https://name.pn/marcus-noble + slug: "/pronouns" title: More about my name and pronouns content: | diff --git a/main.go b/main.go index 1f02c24..9298f72 100644 --- a/main.go +++ b/main.go @@ -35,6 +35,13 @@ func main() { panic(err) } + for _, l := range data["social"].([]interface{}) { + link := l.(map[interface{}]interface{}) + if link["slug"] != "" { + http.Handle(link["slug"].(string), http.RedirectHandler(link["url"].(string), http.StatusTemporaryRedirect)) + } + } + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { page := "src" + r.URL.Path if strings.HasSuffix(page, "/") {