fix rel="me" links on home page

This commit is contained in:
sloane 2024-02-24 21:48:47 -05:00
parent 41a6aa367b
commit 07f0230307
2 changed files with 31 additions and 22 deletions

View file

@ -24,7 +24,8 @@ defmodule SloaneSH.Layouts.Helpers do
end end
def picture(ctx, src, alt \\ "", class \\ "") do def picture(ctx, src, alt \\ "", class \\ "") do
image = Enum.find(ctx.images, fn i -> image =
Enum.find(ctx.images, fn i ->
output = OutputDirs.image(ctx.config, i.src) output = OutputDirs.image(ctx.config, i.src)
src == OutputDirs.to_permalink(ctx.config, output) src == OutputDirs.to_permalink(ctx.config, output)
end) end)
@ -33,24 +34,30 @@ defmodule SloaneSH.Layouts.Helpers do
Logger.warning("Could not find #{inspect(src)} to make picture element") Logger.warning("Could not find #{inspect(src)} to make picture element")
~s|<img src="#{src}" alt="#{alt}" class="#{class}">| ~s|<img src="#{src}" alt="#{alt}" class="#{class}">|
else else
[{_, src} | srcsets] = [ [{_, src} | srcsets] =
[
{"image/jpg", ".jpg"}, {"image/jpg", ".jpg"},
{"image/webp", ".webp"}, {"image/webp", ".webp"},
{"image/png", ".png"}, {"image/png", ".png"}
] ]
|> Enum.map(fn {type, ext} -> |> Enum.map(fn {type, ext} ->
{type, OutputDirs.replace_ext(src, ext)} {type, OutputDirs.replace_ext(src, ext)}
end) end)
EEx.eval_string(
EEx.eval_string(~S""" ~S"""
<picture class="<%= class %>"> <picture class="<%= class %>">
<%= for {type, srcset} <- srcsets do %> <%= for {type, srcset} <- srcsets do %>
<source srcset="<%= srcset %>" type="<%= type %>" /> <source srcset="<%= srcset %>" type="<%= type %>" />
<% end %> <% end %>
<img src="<%= src %>" alt="<%= alt %>" /> <img src="<%= src %>" alt="<%= alt %>" />
</picture> </picture>
""", src: src, srcsets: srcsets, alt: alt, class: class) """,
src: src,
srcsets: srcsets,
alt: alt,
class: class
)
end end
end end
end end

View file

@ -7,9 +7,11 @@ hey, i'm sloane! i'm a professional software engineer and an amateur musician, p
### around the web ### around the web
- <a rel="me" href="https://tech.lgbt/@sloane">@sloane</a> on the fediverse <ul>
- [@sloanelybutsurely](https://github.com/sloanelybutsurely) on github <li><a rel="me" href="https://tech.lgbt/@sloane" target="_blank">@sloane</a> on the fediverse</li>
- [@sloane_of_arc](https://instagram.com/sloane_of_arc) on instagram <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 ### 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 ### 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. real-time collaboration across obsidian and the web. currently in closed beta.