Skip to content

Commit

Permalink
feat: add footer and social links
Browse files Browse the repository at this point in the history
  • Loading branch information
rhnvrm committed May 25, 2021
1 parent b92ed73 commit 127246d
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ static_files = "static/custom"
[auth]
username="username"
password="password"

[social]
facebook = ""
instagram = ""
linkedin = ""
twitter = ""
youtube = ""
26 changes: 26 additions & 0 deletions home.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,27 @@ <h5>{{.Intro}}</h5>
</a>
</div>
{{ end }}

<hr>

<div class="row">
<div class="social">
{{ range $k, $v := .Social }}
{{ if ne $v "" }}
<a href="{{$v}}" style="text-decoration:none;">
<i data-feather="{{$k}}"></i>
</a>
{{ end }}
{{ end }}
</div>
</div>

<div class="row footer">
powered by <a href="https://github.com/rhnvrm/linkpage">LinkPage</a>
</div>
</div>
<script type="text/javascript">

async function fetchAsync (url) {
let response = await fetch(url);
let data = await response.json();
Expand All @@ -52,5 +71,12 @@ <h5>{{.Intro}}</h5>
return true
}
</script>
<script src="static/app/js/feather.min.js"></script>
<script>

document.addEventListener("DOMContentLoaded", function(event) {
feather.replace()
});
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type Config struct {
StaticFileDir string `koanf:"static_files"`

Auth CfgAuth `koanf:"auth"`

Social map[string]string `koanf:"social"`
}

type CfgAuth struct {
Expand Down Expand Up @@ -99,6 +101,8 @@ type Page struct {
OGPURL string
OGPImage string
OGPDesc string

Social map[string]string
}

type cachedTemplate struct {
Expand Down Expand Up @@ -292,6 +296,7 @@ func runApp(configFilePath string) {
LogoURL: cfg.PageLogoURL,
Title: cfg.PageTitle,
Intro: cfg.PageIntro,
Social: cfg.Social,
},
DB: &LinkDB{db},
Templates: Templates{
Expand Down
19 changes: 19 additions & 0 deletions static/app/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ body {
.container {
max-width: 800px;
}

.header {
margin-top: 6rem;
text-align: center;
}

.link {
margin-top: 10px;
background: #4361d8;
Expand All @@ -18,19 +20,23 @@ body {
height: 100px;
text-align: center;
}

.link:hover {
background: #1d2d2c;
border-color: #273d3b;
}

.link a {
color: #fff;
}

.text {
font-size: 16px;
padding: 20px;
text-align: center;
width: 100%;
}

.thumbnail {
width: 100px;
height: 100px;
Expand All @@ -40,9 +46,11 @@ body {
margin-top: 10px;
display: flex;
}

.push {
margin-left: auto;
}

.stats a {
text-decoration: none;
margin-right: 5px;
Expand Down Expand Up @@ -77,3 +85,14 @@ body {
display: flex;
text-decoration: none;
}

.social {
margin: auto;
width: fit-content;
}

.footer {
color: dimgray;
width: fit-content;
margin: auto;
}
13 changes: 13 additions & 0 deletions static/app/js/feather.min.js

Large diffs are not rendered by default.

0 comments on commit 127246d

Please sign in to comment.