tangled
alpha
login
or
join now
ericwood.org
/
photos-site
1
fork
atom
A little app to serve my photography from my personal website
1
fork
atom
overview
issues
pulls
pipelines
meta tags and helpers and stuff
ericwood.org
3 months ago
0043c3c4
eb73c897
0/0
Waiting for spindle ...
+21
-3
4 changed files
expand all
collapse all
unified
split
src
templates.rs
views
photos
index
template.jinja
show
template.jinja
templates
layout.jinja
+10
src/templates.rs
reviewed
···
24
24
env.add_function("url_escape", url_escape);
25
25
env.add_function("inline_style", inline_style);
26
26
env.add_function("inline_script", inline_script);
27
27
+
env.add_function("photo_thumbnail_url", photo_thumbnail_url);
28
28
+
env.add_function("photo_url", photo_url);
27
29
env.add_global(
28
30
"nav_links",
29
31
Value::from_serialize([
···
100
102
let script = read_to_string(path).expect("unable to locate script");
101
103
format!("<script type=\"text/javascript\">\n{script}\n</script>")
102
104
}
105
105
+
106
106
+
fn photo_thumbnail_url(photo_id: String) -> String {
107
107
+
format!("/photos/thumbnails/{photo_id}.webp")
108
108
+
}
109
109
+
110
110
+
fn photo_url(filename: String) -> String {
111
111
+
format!("/photos/images/{filename}")
112
112
+
}
+3
-2
src/views/photos/index/template.jinja
reviewed
···
1
1
{% extends "layout" %}
2
2
-
{% set active_page = 'photos' %}
2
2
+
{% set active_page = "photos" %}
3
3
+
{% set meta_description = "Eric's photo gallery" %}
3
4
{% block title %}Photos{% endblock %}
4
5
{% block head %}
5
6
{{ inline_style("src/views/photos/index/style.css") }}
···
25
26
{% if loop.index < 6 %}
26
27
fetchpriority="high"
27
28
{% endif %}
28
28
-
src="/photos/thumbnails/{{ photo.id }}.webp"
29
29
+
src="{{ photo_thumbnail_url(photo.id) }}"
29
30
>
30
31
</a>
31
32
{% endfor %}
+3
-1
src/views/photos/show/template.jinja
reviewed
···
1
1
{% extends "layout" %}
2
2
{% set active_page = 'photos' %}
3
3
+
{% set meta_description = "Eric's photo gallery" %}
4
4
+
{% set meta_image = photo_thumbnail_url(photo.id) %}
3
5
{% block title %}Photos / View{% endblock %}
4
6
{% block head %}
5
7
{{ inline_style("src/views/photos/show/style.css") }}
···
7
9
{% block body %}
8
10
<div class="photo__container">
9
11
<div class="photo__image">
10
10
-
<img src="/photos/images/{{ photo.filename }}">
12
12
+
<img src="{{ photo_url(photo.filename) }}">
11
13
</div>
12
14
<div class="photo__sidebar">
13
15
<h2>Metadata</h2>
+5
templates/layout.jinja
reviewed
···
3
3
<head>
4
4
<meta charset="utf-8">
5
5
<meta name="viewport" content="width=device-width,initial-scale=1.0">
6
6
+
<meta name="description" content="{{ meta_description|default("Eric, online") }}">
7
7
+
{% if meta_image is defined %}
8
8
+
<meta property="og:image" content="{{ meta_image }}">
9
9
+
{% endif %}
10
10
+
<meta property="og:type" content="website">
6
11
<link rel="stylesheet" href="/photos/assets/fonts/inter/inter.css">
7
12
<style type="text/css">
8
13
:root { font-family: 'Inter', serif; }