Add files via upload

This commit is contained in:
Chesapeake 2021-12-26 15:24:09 -05:00 committed by GitHub
parent 742809cab1
commit 5e62cf6fda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 191 additions and 0 deletions

10
Caddyfile Normal file
View File

@ -0,0 +1,10 @@
localhost {
templates
encode zstd gzip
root * /path/to/bloggy # Change this
file_server
rewrite /blog/* blog.html
handle_errors {
respond "{http.error.status_code} {http.error.status_text}"
}
}

28
blog.html Normal file
View File

@ -0,0 +1,28 @@
{{$siteName := (include "/siteName")}}
{{$pathParts := splitList "/" .OriginalReq.URL.Path}}
{{$markdownFilename := default "index" (slice $pathParts 2 | join "/")}}
{{$markdownFilePath := printf "/markdown/%s.md" $markdownFilename}}
{{if not (fileExists $markdownFilePath)}}{{httpError 404}}{{end}}
{{$markdownFile := (include $markdownFilePath | splitFrontMatter)}}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{$markdownFilename}} - {{$siteName}}</title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<div class="outer">
<div class="inner">
<article>
{{markdown $markdownFile.Body}}
</article>
<hr>
<p class="footer">
<a href="/index.html">back to index</a>
</p>
</div>
</div>
</body>
</html>

26
index.html Normal file
View File

@ -0,0 +1,26 @@
{{$siteName := (include "/siteName")}}
{{$files := (listFiles "/markdown")}}
{{$length := (len $files)}}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{$siteName}}</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="outer">
<div class="inner">
<h1>Welcome to {{$siteName}}!</h1>
<hr>
{{range $files}}
<p>
<a href="/blog/{{trimSuffix ".md" (first $files)}}">{{trimSuffix ".md" (first $files)}}</a>
</p>
{{$files = (rest $files)}}
{{end}}
</div>
</div>
</body>
</html>

42
markdown/Sample 1.md Normal file
View File

@ -0,0 +1,42 @@
# Sample 1
---
This is a sample file.
*Emphasized text*
**Strong text**
`Code`
> Block quote
* Bulleted list
* List list list
* More list
1. Numbered list
2. It has numbers
3. Blah blah blah
* You can nest lists too
1. Like
2. This
* Isn't that cool?
Here is a [link](https://wikipedia.org)
And here is a table
Header | Another Header | Yet Another Header
---------|----------------|-------------------
Value 11 | Value 12 | Value 13
Value 21 | Value 22 | Value 23
Value 31 | Value 32 | Value 33
You can escape stuff with backslashes: \*escaped!\*
You can add images too.
![This is an image.](https://picsum.photos/1024)
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

11
markdown/Sample 2.md Normal file
View File

@ -0,0 +1,11 @@
# Sample 2
---
Aspernatur tenetur id at. In dolor expedita aut doloremque qui. Et eum excepturi amet ut. Ut esse dicta eos reiciendis ullam et.
Natus excepturi ut et non omnis. Ratione ullam sunt quo neque amet hic. Ad qui labore iste molestiae quaerat atque iste perferendis. Facere odio suscipit officiis vel sit aut sapiente dolores. Velit voluptatum quidem corrupti distinctio. Deleniti consectetur similique quasi mollitia est sint quae nesciunt.
Et omnis beatae nesciunt. Ut aut laudantium maxime velit est nihil eveniet. Occaecati similique animi libero sunt voluptatem eligendi. Praesentium corporis voluptatem illo tempora alias voluptas est.
Similique saepe deserunt nulla officia et dignissimos sit vel. Tempora occaecati repudiandae doloribus corporis iusto excepturi id in. Beatae quidem ea fugiat. Sint officia amet atque optio quam. Inventore quisquam velit ratione itaque architecto quia eligendi nesciunt. Quo nisi veniam eos provident voluptates aut dolores placeat.
Aut qui quam sint ipsam voluptatem. Incidunt corporis atque consequatur assumenda alias fugiat atque. Ipsa repellendus assumenda facilis ut. Animi tempore suscipit nihil qui possimus. Dolor voluptatibus quos dolor. Magnam earum eveniet quae omnis eos pariatur.

1
siteName Normal file
View File

@ -0,0 +1 @@
Bloggy

73
style.css Normal file
View File

@ -0,0 +1,73 @@
:root {
--fg: black;
--light: blue;
--dark: purple;
--bg: white;
--shadow: grey;
}
* {
color: var(--fg);
background-color: var(--bg);
font-family: sans-serif;
text-align: left;
}
article {
text-align: center;
}
html {
height: 100%;
margin: 0;
padding: 0;
}
body {
height: 100%;
margin: 0;
padding: 0;
}
img {
max-width: 80%;
margin: 0 10% 0 10%;
max-height: 100%;
}
h1, h2, h3, h4, h5, h6{
text-align: center;
}
code {
font-family: monospace;
}
table{
border-style: solid;
border-width: thin;
border-color: var(--fg);
}
th {
border-style: solid;
border-width: thin;
border-color: var(--fg);
color: var(--bg);
background: var(--fg);
padding: 0.5em;
}
td{
border-style: solid;
border-width: thin;
border-color: var(--fg);
padding: 0.5em;
}
.outer {
display: flex;
justify-content: center;
width: 100%;
height: 100%;
}
.inner {
width: 50em;
max-width: 75vw;
text-align: center;
margin-left: auto;
margin-right: auto;
}
.footer {
text-align: center;
}