Skip to content

Commit

Permalink
Photo Page...
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofzerbe committed Sep 7, 2023
1 parent d35a039 commit 93bcff8
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 35 deletions.
27 changes: 13 additions & 14 deletions themes/landscape/layout/_partial/post/interaction.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,24 @@
}
});
}
let synText = "";
if (synArray.length > 0) {
synText = "or by replying to its syndication on " + synArray.join(" or ");
}
let commentText = "";
if (comments) {
commentText = "... or you leave a good old comment with your GitHub account";
}
%>

<div class="article-interaction" data-pagefind-ignore>
<% if (synArray.length > 0) { %>
<p>
You can interact with this <%= type %> (applause, criticism, whatever)
by mention it in one of your posts or by replying to its syndication on
<%- synArray.join(" or ") %>, which will also be shown here as a
<a href="https://en.wikipedia.org/wiki/Webmention"><em>Webmention</em></a> ...
or you leave a good old <strong>comment</strong> with your GitHub account.
</p>
<% } else { %>
<p>
You can interact with this <%= type %> (applause, criticism, whatever)
by mention it in one of your posts, which will be shown here as a
<a href="https://en.wikipedia.org/wiki/Webmention"><em>Webmention</em></a>, or
by leaving a good old <strong>comment</strong> with your GitHub account.
by mention it in one of your posts <%- synText %>, which will also be shown here as a
<a href="https://en.wikipedia.org/wiki/Webmention"><em>Webmention</em></a> <%- commentText %>.
</p>
<% } %>
</div>

<div class="article-webmentions" data-pagefind-ignore>
Expand All @@ -51,7 +50,7 @@

<script>
window.addEventListener('load', function () {
insertWebmentions('<%- post.slug.toLowerCase() %>', '<%- config.url %>', '<%- config.author %>');
insertWebmentions('<%- post.slug %>', '<%- config.url %>', '<%- config.author %>');
});
</script>

Expand Down
56 changes: 35 additions & 21 deletions themes/landscape/layout/photo.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@
<%- partial('_partial/photograph') %>
<% } %>

<%
function convertDecimalToFraction(decimalValue) {
//https://www.insidethediv.com/javascript-simple-projects-with-source-code-fraction-calculator
const [whole, decimal] = decimalValue.toString().split('.');
const numerator = + (whole + decimal);
const denominator = Math.pow(10, decimal.length);
const gcf = getGCF(numerator, denominator);
const fraction = reduceFraction(numerator/gcf, denominator/gcf);
return fraction.join("/");
function getGCF(a, b) {
if (b === 0) {
return a;
}
return getGCF(b, a % b);
}
function reduceFraction(numerator, denominator) {
const gcf = getGCF(numerator, denominator);
return [numerator/gcf, denominator/gcf];
}
}
%>

<h1 class="archive-title">
<span>Photo<b>|</b></span><%= page.name %>
</h1>
Expand Down Expand Up @@ -40,31 +66,19 @@
</li>
<li>
<label>Keywords</label>
<span><%= page.meta.Keywords.join(", ") %></span>
<span><%= page.meta.Keywords?.join(", ") %></span>
</li>
<li>
<label>Artist</label>
<span><%= page.meta.Artist ?? "---" %></span>
</li>
<li>
<label>Copyright</label>
<span><%= page.meta.Copyright ?? "---" %></span>
<label>Artist, Copyright</label>
<span><%= page.meta.Artist ?? "---" %>, &copy; <%= page.meta.Copyright ?? "---" %> CC-BY-SA</span>
</li>
<li>
<label>Create Date</label>
<span><%= page.meta.CreateDate ?? "---" %></span>
</li>
<li>
<label>Country</label>
<span><%= page.meta.Country ?? "---" %></span>
</li>
<li>
<label>State</label>
<span><%= page.meta.State ?? "---" %></span>
<span><%= new Date(page.meta.CreateDate).toLocaleString('de-DE', { weekday:"long", year:"numeric", month:"long", day:"numeric", hour: "2-digit", minute: "2-digit"}) ?? "---" %></span>
</li>
<li>
<label>City</label>
<span><%= page.meta.City ?? "---" %></span>
<label>Country, State, City</label>
<span><%= (page.meta?.Country?? "---") + ", " + (page.meta.State ?? "---") + ", " + (page.meta.City ?? "---") %></span>
</li>
<li>
<label>Camera</label>
Expand All @@ -76,19 +90,19 @@
</li>
<li>
<label>Focal Length</label>
<span><%= page.meta.FocalLength ?? "---" %></span>
<span><%= (page.meta.FocalLength + "mm") ?? "---" %></span>
</li>
<li>
<label>ISO</label>
<span><%= page.meta.ISO ?? "---" %></span>
</li>
<li>
<label>FNumber</label>
<span><%= page.meta.FNumber ?? "---" %></span>
<span><em>f&nbsp;</em><%= page.meta.FNumber ?? "---" %></span>
</li>
<li>
<label>Exposure Time</label>
<span><%= page.meta.ExposureTime ?? "---" %></span>
<span><%= convertDecimalToFraction(page.meta.ExposureTime) ?? "---" %></span>
</li>
<li>
<label>Shutter Speed</label>
Expand Down

0 comments on commit 93bcff8

Please sign in to comment.