fix: static hosting

This commit is contained in:
Yanislav Igonin 2022-02-28 11:59:50 +02:00
parent 03f0dfc55d
commit 2c19a7794d
8 changed files with 15 additions and 15 deletions

View File

@ -37,7 +37,7 @@ func getCssFilesPaths() []string {
panic(err) panic(err)
} }
for _, file := range files { for _, file := range files {
paths = append(paths, "/static/styles/"+file.Name()) paths = append(paths, "static/styles/"+file.Name())
} }
return paths return paths
} }
@ -47,7 +47,7 @@ func createCssMap() map[string]string {
var cssMap = make(map[string]string) var cssMap = make(map[string]string)
origPaths := getCssFilesPaths() origPaths := getCssFilesPaths()
for _, origPath := range origPaths { for _, origPath := range origPaths {
newPath := "/static/styles/" + randomString(10) + ".css" newPath := "static/styles/" + randomString(10) + ".css"
cssMap[origPath] = newPath cssMap[origPath] = newPath
} }

View File

@ -2,7 +2,7 @@
<footer class="py-4"> <footer class="py-4">
<div class="container text-center"> <div class="container text-center">
<a href="https://github.com/yanislav-igonin/micrach" target="blank"> <a href="https://github.com/yanislav-igonin/micrach" target="blank">
<img class="github-icon" src="/static/icons/github.svg" alt="github icon"> <img class="github-icon" src="static/icons/github.svg" alt="github icon">
</a> </a>
</div> </div>
</footer> </footer>

View File

@ -10,7 +10,7 @@
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj"
crossorigin="anonymous"> crossorigin="anonymous">
</script> </script>
<link rel="icon" href="/static/favicon.ico"/> <link rel="icon" href="static/favicon.ico"/>
<link href="/static/styles/utils.css" rel="stylesheet"> <link href="static/styles/utils.css" rel="stylesheet">
<link href="/static/styles/post-form.css" rel="stylesheet"> <link href="static/styles/post-form.css" rel="stylesheet">
{{ end }} {{ end }}

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
{{ template "static" }} {{ template "static" }}
<link href="/static/styles/error-image.css" rel="stylesheet"> <link href="static/styles/error-image.css" rel="stylesheet">
{{ template "meta-tags-static" }} {{ template "meta-tags-static" }}
</head> </head>
@ -13,7 +13,7 @@
<a href="/" class="error-image-link"> <a href="/" class="error-image-link">
<img <img
class="error-image" class="error-image"
src="/static/images/errors/404.png" src="static/images/errors/404.png"
alt="Bad request" alt="Bad request"
> >
</a> </a>

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
{{ template "static" }} {{ template "static" }}
<link href="/static/styles/error-image.css" rel="stylesheet"> <link href="static/styles/error-image.css" rel="stylesheet">
{{ template "meta-tags-static" }} {{ template "meta-tags-static" }}
</head> </head>
@ -13,7 +13,7 @@
<a href="/" class="error-image-link"> <a href="/" class="error-image-link">
<img <img
class="error-image" class="error-image"
src="/static/images/errors/404.png" src="static/images/errors/404.png"
alt="Not found" alt="Not found"
> >
</a> </a>

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
{{ template "static" }} {{ template "static" }}
<link href="/static/styles/error-image.css" rel="stylesheet"> <link href="static/styles/error-image.css" rel="stylesheet">
{{ template "meta-tags-static" }} {{ template "meta-tags-static" }}
</head> </head>
@ -13,7 +13,7 @@
<a href="/" class="error-image-link"> <a href="/" class="error-image-link">
<img <img
class="error-image" class="error-image"
src="/static/images/errors/500.png" src="static/images/errors/500.png"
alt="All broken" alt="All broken"
> >
</a> </a>

View File

@ -3,7 +3,7 @@
<head> <head>
{{ template "static" }} {{ template "static" }}
<link href="/static/styles/index.css" rel="stylesheet"> <link href="static/styles/index.css" rel="stylesheet">
{{ template "meta-tags-static" }} {{ template "meta-tags-static" }}
</head> </head>

View File

@ -6,8 +6,8 @@
<head> <head>
{{ template "static" }} {{ template "static" }}
{{ template "meta-tags-dynamic" $FirstPost }} {{ template "meta-tags-dynamic" $FirstPost }}
<link href="/static/styles/thread.css" rel="stylesheet"> <link href="static/styles/thread.css" rel="stylesheet">
<link href="/static/styles/post.css" rel="stylesheet"> <link href="static/styles/post.css" rel="stylesheet">
</head> </head>
<body> <body>