Skip to content

Commit

Permalink
fix: css, codeblock rendering, author tag
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaklog committed Mar 6, 2024
1 parent 052c74f commit 0b95923
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 28 deletions.
1 change: 1 addition & 0 deletions cmd/ssg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type LayoutConfig struct {
BaseURL string `yaml:"baseURL"`
SiteTitle string `yaml:"siteTitle"`
SiteScripts []string `yaml:"siteScripts"`
Author string `yaml:"author"`
}

type Frontmatter struct {
Expand Down
1 change: 1 addition & 0 deletions content/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ scripts:
description: "documentation for our ssg"
---


## Directory structure

The ssg currently requires the following directory structure
Expand Down
10 changes: 10 additions & 0 deletions content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ description: "homepage for our ssg"

# Henlo!

```text
___
/ | ____ ____ ____ _
/ /| | / __ \/ __ \/ __ `/
/ ___ |/ / / / / / / /_/ /
/_/ |_/_/ /_/_/ /_/\__,_/
A static site generator in go
```

This is the documentation for the SSG

![demo-image](/static/plane.jpg)
3 changes: 2 additions & 1 deletion layout/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ navbar:
baseURL: https://ssg-test-org.github.io
siteTitle: ssg
siteScripts:
- prism.js
# - prism.js
author: Anna
13 changes: 12 additions & 1 deletion layout/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{{ template "head" .}}

<body>
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>

<!-- and it's easy to individually load additional languages -->
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/languages/go.min.js"></script>

{{template "header" .}}

<div class="body">
Expand All @@ -13,10 +18,16 @@
data-slug="adityahegde" data-color="#FF5F5F" data-emoji="" data-font="Cookie" data-text="Buy me a coffee"
data-outline-color="#000000" data-font-color="#ffffff" data-coffee-color="#FFDD00"></script> -->

<script>hljs.highlightAll();</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// document.querySelectorAll('hljs').style.background = "#1e1e2d";
})
</script>
</body>

{{template "footer" .}}

</html>

{{ end}}
{{ end}}
2 changes: 1 addition & 1 deletion layout/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{define "footer"}}
<footer>
Rendered using a <a href="https://github.com/acmpesuecc/ssg">custom ssg</a>
Rendered using a <a href="https://github.com/acmpesuecc/ssg">anna</a> ❤️
</footer>
{{end}}
5 changes: 4 additions & 1 deletion layout/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="preload stylesheet" href="/static/style.css">
<link rel="stylesheet" href="/static/prism.css">
<link rel="alternate" type="application/atom+xml" title="feed" href="/feed.atom">

{{range .Frontmatter.JSFiles}}
<script src="/script/{{.}}" defer></script>
{{end}}
Expand All @@ -21,5 +21,8 @@
<meta property="og:description" content="{{ .Frontmatter.Description }}">
<meta property="og:image" content="{{ .Frontmatter.PreviewImage }}">

<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css"> -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/tokyo-night-dark.min.css">

</head>
{{end}}
6 changes: 5 additions & 1 deletion layout/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<header>
<nav>
{{range .Layout.Navbar}}
<a href="/{{.}}.html">{{.}}</a>
{{ if eq . "index" }}
<a href="/">[{{ $.Layout.Author }}]</a>
{{else}}
<a href="/{{.}}.html">[{{.}}]</a>
{{end}}
{{end}}
</nav>
</header>
Expand Down
75 changes: 52 additions & 23 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
body {

font-family: custom-font, agave, monospace;
font-size: .9rem;
line-height: 1.6;

background-color: #000000;
background-color: #11111a;
color: #ffffff;

display: flex;
Expand All @@ -42,22 +41,27 @@ footer {
width: 100%;
flex: 0;

font-size: 1.1rem;
align-self: center;
padding: 1rem 0;

text-align: center;
}

nav {
font-size: 1.8rem;
font-size: 1.4rem;

margin: auto;
margin-top: 1.2rem;
margin-bottom: 1.2rem;

display: flex;
justify-content: center;
gap: 2rem;
flex-wrap: wrap;
gap: 0.5rem;

& > a {
word-wrap: break-word;
}
}

a {
Expand All @@ -68,6 +72,15 @@ a {
transition: color 150ms ease-in-out
}

/* Thank you, @kepano! */
a:not(.plain):not(.tag):not(.internal-link):not(.footnote):not( .reversefootnote ):not(.post-card) {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2.5' stroke='gray' class='w-6 h-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M4.5 19.5l15-15m0 0H8.25m11.25 0v11.25' /%3E%3C/svg%3E%0A");
background-position: right 33%;
background-repeat: no-repeat;
background-size: 0.7em;
padding-right: 0.75em;
}

a:hover {
/* color:#5990ac; */
text-decoration: underline;
Expand All @@ -90,14 +103,14 @@ h1, h2, h3, h4, h5, h6 {
color: #5990ac;
}

h1 { font-size: 3rem;}
h2 { font-size: 2.5rem;}
h3 { font-size: 2.0rem;}
h4 {font-size: 1.8rem;}
h1 { font-size: 2.5rem;}
h2 { font-size: 2.2rem;}
h3 { font-size: 1.85rem;}
h4 {font-size: 1.7rem;}

.body {
flex: 1 0 auto;

& > a,
& > ul > li > a,
& > ol > li > a,
Expand All @@ -112,10 +125,10 @@ h4 {font-size: 1.8rem;}
padding: 0;
}

& > a,
& > p, & > ul > li,
& > ol > li,
& > ul > li > a,
& > a,
& > p, & > ul > li,
& > ol > li,
& > ul > li > a,
& > ol > li > a {
font-size: 1.3rem;
}
Expand Down Expand Up @@ -145,7 +158,7 @@ img {
flex-direction: column;
/* align-items: center; */
margin: auto;

& > a {
background-color: #41414141;
border-radius: 5px;
Expand Down Expand Up @@ -211,6 +224,19 @@ img {
min-width: 100px;
padding: 1rem;
} */

pre code {
font-family: agave, monospace;
background: white;
overflow-x: scroll;
scrollbar-width: none;
border-radius: .5rem;
}

pre code.hljs {
background: #1e1e2d;
}

p > code,
li > code,
dd>code,
Expand All @@ -231,10 +257,9 @@ td>code {
/* styling for viewports width < 600px */
@media (max-width: 600px) {
nav {
font-size: 1.5rem;
gap: 1.5rem;
font-size: 1.1rem;
}

body {
margin-inline: 5%;
}
Expand All @@ -251,12 +276,16 @@ td>code {
}

.body {
& > a,
& > p, & > ul > li,
& > ol > li,
& > ul > li > a,
& > a,
& > p, & > ul > li,
& > ol > li,
& > ul > li > a,
& > ol > li > a {
font-size: 1.15rem;
}
}

.post-card > h3 {
font-size: 1.5rem;
}
}

0 comments on commit 0b95923

Please sign in to comment.