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
|
end
|
||||||
|
|
||||||
def picture(ctx, src, alt \\ "", class \\ "") do
|
def picture(ctx, src, alt \\ "", class \\ "") do
|
||||||
image = Enum.find(ctx.images, fn i ->
|
image =
|
||||||
output = OutputDirs.image(ctx.config, i.src)
|
Enum.find(ctx.images, fn i ->
|
||||||
src == OutputDirs.to_permalink(ctx.config, output)
|
output = OutputDirs.image(ctx.config, i.src)
|
||||||
end)
|
src == OutputDirs.to_permalink(ctx.config, output)
|
||||||
|
end)
|
||||||
|
|
||||||
if is_nil(image) do
|
if is_nil(image) 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/webp", ".webp"},
|
{"image/jpg", ".jpg"},
|
||||||
{"image/png", ".png"},
|
{"image/webp", ".webp"},
|
||||||
]
|
{"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
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in a new issue