diff --git a/routes.go b/routes.go index 937084c..2f6977d 100644 --- a/routes.go +++ b/routes.go @@ -123,6 +123,13 @@ var funcMap = template.FuncMap{ } return false }, + "isYoutube": func(u string) bool { + re := regexp.MustCompile(`^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube(-nocookie)?\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|live\/|v\/)?)([\w\-]+)(\S+)?$`) + if re.MatchString(u) { + return true + } + return false + }, "thumbnail": func(p lemmy.Post) string { if p.ThumbnailURL.IsValid() { return p.ThumbnailURL.String() + "?format=jpg&thumbnail=96" diff --git a/templates/post.html b/templates/post.html index 5add8e3..b3f65b4 100644 --- a/templates/post.html +++ b/templates/post.html @@ -41,7 +41,7 @@ ({{ domain . }}) -
+
submitted {{ humanize .Post.Published.Time -}}