mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 22:32:33 +03:00
refactoring: make separate files for embeded templates
This commit is contained in:
parent
fcc6330b19
commit
35934c04f0
@ -6,7 +6,7 @@
|
|||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
>
|
>
|
||||||
|
|
||||||
{{ template "static-meta" }}
|
{{ template "meta-tags-static" }}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
22
templates/meta-tags-dynamic.html
Normal file
22
templates/meta-tags-dynamic.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{{ define "meta-tags-dynamic" }}
|
||||||
|
<title>{{ .Title }}</title>
|
||||||
|
<!-- Primary Meta Tags -->
|
||||||
|
<meta charset="UTF-8"/>
|
||||||
|
<meta name="title" content="{{ .Title }}">
|
||||||
|
<meta name="description" content="{{ .Text }}">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
<!-- Open Graph / Facebook -->
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
<meta property="og:url" content="https://micrach.igonin.dev/{{ .ID }}">
|
||||||
|
<meta property="og:title" content="{{ .Title }}">
|
||||||
|
<meta property="og:description" content="{{ .Text }}">
|
||||||
|
<meta property="og:image" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
||||||
|
|
||||||
|
<!-- Twitter -->
|
||||||
|
<meta property="twitter:card" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
||||||
|
<meta property="twitter:url" content="https://micrach.igonin.dev/{{ .ID }}">
|
||||||
|
<meta property="twitter:title" content="{{ .Title }}">
|
||||||
|
<meta property="twitter:description" content="{{ .Text }}">
|
||||||
|
<meta property="twitter:image" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
||||||
|
{{ end }}
|
22
templates/meta-tags-static.html
Normal file
22
templates/meta-tags-static.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{{ define "meta-tags-static" }}
|
||||||
|
<title>Micrach</title>
|
||||||
|
<!-- Primary Meta Tags -->
|
||||||
|
<meta charset="UTF-8"/>
|
||||||
|
<meta name="title" content="Micrach">
|
||||||
|
<meta name="description" content="Single board imageboard.">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
<!-- Open Graph / Facebook -->
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
<meta property="og:url" content="https://micrach.igonin.dev/">
|
||||||
|
<meta property="og:title" content="Micrach">
|
||||||
|
<meta property="og:description" content="Single board imageboard.">
|
||||||
|
<meta property="og:image" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
||||||
|
|
||||||
|
<!-- Twitter -->
|
||||||
|
<meta property="twitter:card" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
||||||
|
<meta property="twitter:url" content="https://micrach.igonin.dev/">
|
||||||
|
<meta property="twitter:title" content="Micrach">
|
||||||
|
<meta property="twitter:description" content="Single board imageboard.">
|
||||||
|
<meta property="twitter:image" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
||||||
|
{{ end }}
|
48
templates/post-form.html
Normal file
48
templates/post-form.html
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{{ define "post-form" }}
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
|
||||||
|
<div class="col col-lg-6 col-md-8">
|
||||||
|
{{ if eq .FirstPostID 0 }}
|
||||||
|
<form id="postForm" action="/" method="POST" enctype="multipart/form-data">
|
||||||
|
{{ else }}
|
||||||
|
<form id="postForm" action="/{{ .FirstPostID }}" method="POST" enctype="multipart/form-data">
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if eq .FirstPostID 0 }}
|
||||||
|
<input class="form-control" id="postTitle" placeholder="Title" name="title">
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<textarea class="form-control" id="postText" rows="5" placeholder="Text" name="text"></textarea>
|
||||||
|
<input class="form-control" type="file" id="postFiles" multiple name="files">
|
||||||
|
|
||||||
|
<div class="captcha-container text-center">
|
||||||
|
<img src="/captcha/{{ .CaptchaID }}" alt="Captcha">
|
||||||
|
</div>
|
||||||
|
<input class="form-control" type="hidden" name="captchaId" value="{{ .CaptchaID }}">
|
||||||
|
<input class="form-control" id="postCaptcha" placeholder="Captcha" name="captcha">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
{{ if ne .FirstPostID 0 }}
|
||||||
|
<div class="col">
|
||||||
|
<input class="form-check-input" type="checkbox" value="" id="postSage" name="sage">
|
||||||
|
<label class="form-check-label" for="postSage">
|
||||||
|
Sage
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<div class="col text-end">
|
||||||
|
<button class="col btn btn-outline-primary" type="submit" >
|
||||||
|
{{ if ne .FirstPostID 0 }}
|
||||||
|
Send
|
||||||
|
{{ else }}
|
||||||
|
Create thread
|
||||||
|
{{ end }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
18
templates/static.html
Normal file
18
templates/static.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{{ define "static" }}
|
||||||
|
<link
|
||||||
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"
|
||||||
|
rel="stylesheet"
|
||||||
|
integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
>
|
||||||
|
<script
|
||||||
|
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj"
|
||||||
|
crossorigin="anonymous">
|
||||||
|
</script>
|
||||||
|
<link rel="icon" href="/static/favicon.ico"/>
|
||||||
|
<link
|
||||||
|
href="/static/post-form.css"
|
||||||
|
rel="stylesheet"
|
||||||
|
>
|
||||||
|
{{ end }}
|
@ -1,113 +0,0 @@
|
|||||||
{{ define "static" }}
|
|
||||||
<link
|
|
||||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"
|
|
||||||
rel="stylesheet"
|
|
||||||
integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We"
|
|
||||||
crossorigin="anonymous"
|
|
||||||
>
|
|
||||||
<script
|
|
||||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"
|
|
||||||
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj"
|
|
||||||
crossorigin="anonymous">
|
|
||||||
</script>
|
|
||||||
<link rel="icon" href="/static/favicon.ico"/>
|
|
||||||
<link
|
|
||||||
href="/static/post-form.css"
|
|
||||||
rel="stylesheet"
|
|
||||||
>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "meta" }}
|
|
||||||
<title>{{ .Title }}</title>
|
|
||||||
<!-- Primary Meta Tags -->
|
|
||||||
<meta charset="UTF-8"/>
|
|
||||||
<meta name="title" content="{{ .Title }}">
|
|
||||||
<meta name="description" content="{{ .Text }}">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<!-- Open Graph / Facebook -->
|
|
||||||
<meta property="og:type" content="website">
|
|
||||||
<meta property="og:url" content="https://micrach.igonin.dev/{{ .ID }}">
|
|
||||||
<meta property="og:title" content="{{ .Title }}">
|
|
||||||
<meta property="og:description" content="{{ .Text }}">
|
|
||||||
<meta property="og:image" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
|
||||||
|
|
||||||
<!-- Twitter -->
|
|
||||||
<meta property="twitter:card" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
|
||||||
<meta property="twitter:url" content="https://micrach.igonin.dev/{{ .ID }}">
|
|
||||||
<meta property="twitter:title" content="{{ .Title }}">
|
|
||||||
<meta property="twitter:description" content="{{ .Text }}">
|
|
||||||
<meta property="twitter:image" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "static-meta" }}
|
|
||||||
<title>Micrach</title>
|
|
||||||
<!-- Primary Meta Tags -->
|
|
||||||
<meta charset="UTF-8"/>
|
|
||||||
<meta name="title" content="Micrach">
|
|
||||||
<meta name="description" content="Single board imageboard.">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<!-- Open Graph / Facebook -->
|
|
||||||
<meta property="og:type" content="website">
|
|
||||||
<meta property="og:url" content="https://micrach.igonin.dev/">
|
|
||||||
<meta property="og:title" content="Micrach">
|
|
||||||
<meta property="og:description" content="Single board imageboard.">
|
|
||||||
<meta property="og:image" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
|
||||||
|
|
||||||
<!-- Twitter -->
|
|
||||||
<meta property="twitter:card" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
|
||||||
<meta property="twitter:url" content="https://micrach.igonin.dev/">
|
|
||||||
<meta property="twitter:title" content="Micrach">
|
|
||||||
<meta property="twitter:description" content="Single board imageboard.">
|
|
||||||
<meta property="twitter:image" content="https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png">
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "post-form" }}
|
|
||||||
<div class="d-flex justify-content-center">
|
|
||||||
|
|
||||||
<div class="col col-lg-6 col-md-8">
|
|
||||||
{{ if eq .FirstPostID 0 }}
|
|
||||||
<form id="postForm" action="/" method="POST" enctype="multipart/form-data">
|
|
||||||
{{ else }}
|
|
||||||
<form id="postForm" action="/{{ .FirstPostID }}" method="POST" enctype="multipart/form-data">
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if eq .FirstPostID 0 }}
|
|
||||||
<input class="form-control" id="postTitle" placeholder="Title" name="title">
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
<textarea class="form-control" id="postText" rows="5" placeholder="Text" name="text"></textarea>
|
|
||||||
<input class="form-control" type="file" id="postFiles" multiple name="files">
|
|
||||||
|
|
||||||
<div class="captcha-container text-center">
|
|
||||||
<img src="/captcha/{{ .CaptchaID }}" alt="Captcha">
|
|
||||||
</div>
|
|
||||||
<input class="form-control" type="hidden" id="postCaptcha" name="captchaId" value="{{ .CaptchaID }}">
|
|
||||||
<input class="form-control" id="postCaptcha" placeholder="Captcha" name="captcha">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
{{ if ne .FirstPostID 0 }}
|
|
||||||
<div class="col">
|
|
||||||
<input class="form-check-input" type="checkbox" value="" id="postSage" name="sage">
|
|
||||||
<label class="form-check-label" for="postSage">
|
|
||||||
Sage
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
<div class="col text-end">
|
|
||||||
<button class="col btn btn-outline-primary" type="submit" >
|
|
||||||
{{ if ne .FirstPostID 0 }}
|
|
||||||
Send
|
|
||||||
{{ else }}
|
|
||||||
Create thread
|
|
||||||
{{ end }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
@ -3,7 +3,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
{{ template "static" }}
|
{{ template "static" }}
|
||||||
{{ template "meta" $FirstPost }}
|
{{ template "meta-tags-dynamic" $FirstPost }}
|
||||||
<link
|
<link
|
||||||
href="/static/post.css"
|
href="/static/post.css"
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
|
Loading…
Reference in New Issue
Block a user