Render images server side. Remove JS hack to get images to render.
This commit is contained in:
parent
5d67e92245
commit
3eca70a102
9 changed files with 107 additions and 35 deletions
|
@ -1,28 +0,0 @@
|
|||
documentReady(() => {
|
||||
function adornImage(image, append) {
|
||||
var parent = image.parentNode;
|
||||
parent.removeChild(image);
|
||||
image.className = "blog-post__image-container--image";
|
||||
|
||||
var tagLine = document.createElement("span");
|
||||
tagLine.className = "blog-post__image-container--tagline";
|
||||
tagLine.innerText = image.getAttribute("alt");
|
||||
|
||||
var container = document.createElement("div");
|
||||
container.className = "blog-post__image-container";
|
||||
container.appendChild(image);
|
||||
container.appendChild(tagLine);
|
||||
|
||||
var containerContainer = document.createElement("div");
|
||||
containerContainer.className = "blog-post__image-container--container";
|
||||
containerContainer.appendChild(container);
|
||||
|
||||
if (append)
|
||||
parent.appendChild(containerContainer);
|
||||
else
|
||||
parent.prepend(containerContainer);
|
||||
}
|
||||
|
||||
document.querySelectorAll("p>img:only-child,p>img:first-child").forEach(image => adornImage(image, false));
|
||||
document.querySelectorAll("p>img:last-child").forEach(image => adornImage(image, true));
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue