fix rel="me" links on home page
This commit is contained in:
parent
41a6aa367b
commit
07f0230307
2 changed files with 31 additions and 22 deletions
|
@ -24,33 +24,40 @@ defmodule SloaneSH.Layouts.Helpers do
|
|||
end
|
||||
|
||||
def picture(ctx, src, alt \\ "", class \\ "") do
|
||||
image = Enum.find(ctx.images, fn i ->
|
||||
output = OutputDirs.image(ctx.config, i.src)
|
||||
src == OutputDirs.to_permalink(ctx.config, output)
|
||||
end)
|
||||
image =
|
||||
Enum.find(ctx.images, fn i ->
|
||||
output = OutputDirs.image(ctx.config, i.src)
|
||||
src == OutputDirs.to_permalink(ctx.config, output)
|
||||
end)
|
||||
|
||||
if is_nil(image) do
|
||||
Logger.warning("Could not find #{inspect(src)} to make picture element")
|
||||
~s|<img src="#{src}" alt="#{alt}" class="#{class}">|
|
||||
else
|
||||
[{_, src} | srcsets] = [
|
||||
{"image/jpg", ".jpg"},
|
||||
{"image/webp", ".webp"},
|
||||
{"image/png", ".png"},
|
||||
]
|
||||
[{_, src} | srcsets] =
|
||||
[
|
||||
{"image/jpg", ".jpg"},
|
||||
{"image/webp", ".webp"},
|
||||
{"image/png", ".png"}
|
||||
]
|
||||
|> Enum.map(fn {type, ext} ->
|
||||
{type, OutputDirs.replace_ext(src, ext)}
|
||||
end)
|
||||
|
||||
|
||||
EEx.eval_string(~S"""
|
||||
<picture class="<%= class %>">
|
||||
<%= for {type, srcset} <- srcsets do %>
|
||||
<source srcset="<%= srcset %>" type="<%= type %>" />
|
||||
<% end %>
|
||||
<img src="<%= src %>" alt="<%= alt %>" />
|
||||
</picture>
|
||||
""", src: src, srcsets: srcsets, alt: alt, class: class)
|
||||
EEx.eval_string(
|
||||
~S"""
|
||||
<picture class="<%= class %>">
|
||||
<%= for {type, srcset} <- srcsets do %>
|
||||
<source srcset="<%= srcset %>" type="<%= type %>" />
|
||||
<% end %>
|
||||
<img src="<%= src %>" alt="<%= alt %>" />
|
||||
</picture>
|
||||
""",
|
||||
src: src,
|
||||
srcsets: srcsets,
|
||||
alt: alt,
|
||||
class: class
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,9 +7,11 @@ hey, i'm sloane! i'm a professional software engineer and an amateur musician, p
|
|||
|
||||
### around the web
|
||||
|
||||
- <a rel="me" href="https://tech.lgbt/@sloane">@sloane</a> on the fediverse
|
||||
- [@sloanelybutsurely](https://github.com/sloanelybutsurely) on github
|
||||
- [@sloane_of_arc](https://instagram.com/sloane_of_arc) on instagram
|
||||
<ul>
|
||||
<li><a rel="me" href="https://tech.lgbt/@sloane" target="_blank">@sloane</a> on the fediverse</li>
|
||||
<li><a href="https://github.com/sloanelybutsurely" target="_blank">@sloanelybutsurely</a> on github</li>
|
||||
<li><a href="https://instagram.com/sloane_of_arc" target="_blank">@sloane_of_arc</a> on instagram</li>
|
||||
</ul>
|
||||
|
||||
### writing
|
||||
|
||||
|
@ -22,6 +24,6 @@ i write more than i share but here are some things that have made it out of my d
|
|||
|
||||
### projects
|
||||
|
||||
#### 🌱 [screen.garden](https://screen.garden)
|
||||
<h4>🌱 <a href="https://screen.garden" target="_blank">screen.garden</a></h4>
|
||||
|
||||
real-time collaboration across obsidian and the web. currently in closed beta.
|
||||
|
|
Loading…
Reference in a new issue