added optional social media buttons
This commit is contained in:
parent
bfcf1a22e6
commit
5017fa536e
5 changed files with 56 additions and 1 deletions
|
@ -10,6 +10,11 @@ html {
|
||||||
padding-left: 20%;
|
padding-left: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.social-icon {
|
||||||
|
height: 1em;
|
||||||
|
width: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width:1080px) {
|
@media (max-width:1080px) {
|
||||||
html {
|
html {
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
|
|
|
@ -17,5 +17,25 @@
|
||||||
I have a <a href="/blog">blog.</a><br>
|
I have a <a href="/blog">blog.</a><br>
|
||||||
If you have questions or input for me please send me an E-Mail to {{ email }}
|
If you have questions or input for me please send me an E-Mail to {{ email }}
|
||||||
</p>
|
</p>
|
||||||
|
<br>
|
||||||
|
<p>
|
||||||
|
<ul style="list-style: none;">
|
||||||
|
{% if github_account %}
|
||||||
|
<li><img class="social-icon" src="https://github.com/favicon.ico"><a href="https://github.com/{{ github_account }}"> {{ github_account }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% if twitter_account %}
|
||||||
|
<li><img class="social-icon" src="https://twitter.com/favicon.ico"><a href="https://twitter.com/{{ twitter_account }}"> {{ twitter_account }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% if reddit_account %}
|
||||||
|
<li><img class="social-icon" src="https://reddit.com/favicon.ico"><a href="https://reddit.com/u/{{ reddit_account }}"> {{ reddit_account }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% if mastodon_account %}
|
||||||
|
<li><img class="social-icon" src="https://mastodon.social/favicon.ico"><a href="https://discord.com/"> {{ mastodon_account }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% if discord_account %}
|
||||||
|
<li><img class="social-icon" src="https://discord.com/assets/07dca80a102d4149e9736d4b162cff6f.ico"><a href="https://discord.com/"> {{ discord_account }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
2
site/Cargo.lock
generated
2
site/Cargo.lock
generated
|
@ -561,7 +561,7 @@ checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crablog"
|
name = "crablog"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-files",
|
"actix-files",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
|
|
|
@ -21,6 +21,21 @@ pub static CONFIG_MAP: Lazy<RwLock<HashMap<String, String>>> = Lazy::new(|| {
|
||||||
config.insert(String::from("USERNAME"), env::var("USERNAME").expect("USERNAME variable not set."));
|
config.insert(String::from("USERNAME"), env::var("USERNAME").expect("USERNAME variable not set."));
|
||||||
config.insert(String::from("EMAIL"), env::var("EMAIL").expect("EMAIL variable not set."));
|
config.insert(String::from("EMAIL"), env::var("EMAIL").expect("EMAIL variable not set."));
|
||||||
config.insert(String::from("BIND_PORT"), env::var("BIND_PORT").expect("BIND_PORT variable not set."));
|
config.insert(String::from("BIND_PORT"), env::var("BIND_PORT").expect("BIND_PORT variable not set."));
|
||||||
|
if let Ok(acc) = env::var("GITHUB_ACCOUNT") {
|
||||||
|
config.insert(String::from("GITHUB_ACCOUNT"), acc.clone());
|
||||||
|
}
|
||||||
|
if let Ok(acc) = env::var("TWITTER_ACCOUNT") {
|
||||||
|
config.insert(String::from("TWITTER_ACCOUNT"), acc.clone());
|
||||||
|
}
|
||||||
|
if let Ok(acc) = env::var("MASTODON_ACCOUNT") {
|
||||||
|
config.insert(String::from("MASTODON_ACCOUNT"), acc.clone());
|
||||||
|
}
|
||||||
|
if let Ok(acc) = env::var("DISCORD_ACCOUNT") {
|
||||||
|
config.insert(String::from("DISCORD_ACCOUNT"), acc.clone());
|
||||||
|
}
|
||||||
|
if let Ok(acc) = env::var("REDDIT_ACCOUNT") {
|
||||||
|
config.insert(String::from("REDDIT_ACCOUNT"), acc.clone());
|
||||||
|
}
|
||||||
RwLock::new(config)
|
RwLock::new(config)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,21 @@ async fn root(tmpl: web::Data<tera::Tera>) -> Result<HttpResponse, Error> {
|
||||||
let mut context = Context::new();
|
let mut context = Context::new();
|
||||||
context.insert("username", CONFIG_MAP.read().unwrap().get("USERNAME").unwrap());
|
context.insert("username", CONFIG_MAP.read().unwrap().get("USERNAME").unwrap());
|
||||||
context.insert("email", CONFIG_MAP.read().unwrap().get("EMAIL").unwrap());
|
context.insert("email", CONFIG_MAP.read().unwrap().get("EMAIL").unwrap());
|
||||||
|
if let Some(acc) = CONFIG_MAP.read().unwrap().get("GITHUB_ACCOUNT") {
|
||||||
|
context.insert("github_account", acc);
|
||||||
|
}
|
||||||
|
if let Some(acc) = CONFIG_MAP.read().unwrap().get("TWITTER_ACCOUNT") {
|
||||||
|
context.insert("twitter_account", acc);
|
||||||
|
}
|
||||||
|
if let Some(acc) = CONFIG_MAP.read().unwrap().get("MASTODON_ACCOUNT") {
|
||||||
|
context.insert("mastodon_account", acc);
|
||||||
|
}
|
||||||
|
if let Some(acc) = CONFIG_MAP.read().unwrap().get("DISCORD_ACCOUNT") {
|
||||||
|
context.insert("discord_account", acc);
|
||||||
|
}
|
||||||
|
if let Some(acc) = CONFIG_MAP.read().unwrap().get("REDDIT_ACCOUNT") {
|
||||||
|
context.insert("reddit_account", acc);
|
||||||
|
}
|
||||||
|
|
||||||
let result = tmpl.render("index.html", &context)
|
let result = tmpl.render("index.html", &context)
|
||||||
.map_err(|e| error::ErrorInternalServerError(format!("Template error\n{}", e)))?;
|
.map_err(|e| error::ErrorInternalServerError(format!("Template error\n{}", e)))?;
|
||||||
|
|
Loading…
Reference in a new issue