From 5bb58867709e473471c60bd21a8b653229bfa185 Mon Sep 17 00:00:00 2001 From: Thomas Miceli <27960254+thomiceli@users.noreply.github.com> Date: Mon, 17 Jul 2023 03:58:45 +0200 Subject: [PATCH] Make unlisted gists not SEO crawlable (#78) --- internal/web/gist.go | 4 ++++ templates/base/base_header.html | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/internal/web/gist.go b/internal/web/gist.go index c108dcc..e3e1d67 100644 --- a/internal/web/gist.go +++ b/internal/web/gist.go @@ -80,6 +80,10 @@ func gistInit(next echo.HandlerFunc) echo.HandlerFunc { setData(ctx, "hasLiked", hasLiked) } + if gist.Private { + setData(ctx, "NoIndex", true) + } + return next(ctx) } } diff --git a/templates/base/base_header.html b/templates/base/base_header.html index 582136e..415a0c3 100644 --- a/templates/base/base_header.html +++ b/templates/base/base_header.html @@ -3,6 +3,10 @@ + {{ if .NoIndex }} + + {{ end }} +