mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
fix: properly create webmentions section before appending type sections
When no build-time webmentions exist, the first type to be processed was silently dropped because createWebmentionsSection() only creates the wrapper, not the type-specific section. After calling it, the code tried to find the selector which still didn't exist. Fixed by: create wrapper if needed, then always append the section to the wrapper and get the row/list from the newly created section.
This commit is contained in:
@@ -86,13 +86,14 @@
|
||||
// Create section if it doesn't exist
|
||||
if (!row) {
|
||||
const section = createAvatarSection(type);
|
||||
const webmentionsSection = document.getElementById('webmentions');
|
||||
let webmentionsSection = document.getElementById('webmentions');
|
||||
if (!webmentionsSection) {
|
||||
createWebmentionsSection();
|
||||
webmentionsSection = document.getElementById('webmentions');
|
||||
}
|
||||
if (webmentionsSection) {
|
||||
webmentionsSection.appendChild(section);
|
||||
row = section.querySelector('.avatar-row');
|
||||
} else {
|
||||
createWebmentionsSection();
|
||||
row = document.querySelector(selector);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,13 +127,14 @@
|
||||
// Create section if it doesn't exist
|
||||
if (!list) {
|
||||
const section = createReplySection();
|
||||
const webmentionsSection = document.getElementById('webmentions');
|
||||
let webmentionsSection = document.getElementById('webmentions');
|
||||
if (!webmentionsSection) {
|
||||
createWebmentionsSection();
|
||||
webmentionsSection = document.getElementById('webmentions');
|
||||
}
|
||||
if (webmentionsSection) {
|
||||
webmentionsSection.appendChild(section);
|
||||
list = section.querySelector('ul');
|
||||
} else {
|
||||
createWebmentionsSection();
|
||||
list = document.querySelector(selector);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,13 +222,14 @@
|
||||
|
||||
if (!list) {
|
||||
const section = createMentionSection();
|
||||
const webmentionsSection = document.getElementById('webmentions');
|
||||
let webmentionsSection = document.getElementById('webmentions');
|
||||
if (!webmentionsSection) {
|
||||
createWebmentionsSection();
|
||||
webmentionsSection = document.getElementById('webmentions');
|
||||
}
|
||||
if (webmentionsSection) {
|
||||
webmentionsSection.appendChild(section);
|
||||
list = section.querySelector('ul');
|
||||
} else {
|
||||
createWebmentionsSection();
|
||||
list = document.querySelector(selector);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user