0

I have an RTL (Hebrew) MediaWiki 1.34.0 website in which I am having a serious problem creating footnotes for articles with the core Extension:Cite because its de facto lack of support in Hebrew, as described in great depth here:

Therefore, I thought of the following alternative approach;

Creating a JavaScript front end alternative to create footnotes in a similar way to that of MediaWiki Cite extension

It should run after enabling support in raw HTML (and after heeding associated warnings):

Manual:$wgRawHtml

The code should look approximately like this (unfinished code):

Template:Footnote (תבנית:הערה)

<includeonly><span dir="rtl" class="footnote"><sup class="footnote_inner">{{{1}}}</sup></span></includeonly><noinclude>

[[קטגוריה:תבניות]]
</noinclude>

JavaScript

document.querySelectorAll(".footnote>sup").forEach((element, i) => {
    const li = document.createElement("li");
    li.append(...element.childNodes);
    element.textContent = i + 1;
    const footnotes_list = document.querySelector(".footnotes_list"); 
    footnotes_list.appendChild(li); 
});

const numbers = Array.from(Array(100)).map((e,i)=>i+1)
document.querySelectorAll(".footnote").forEach( (element, i)=>{
    element.setAttribute("href", `#footnote_${numbers[i]}`)
    element.setAttribute("id", "fn_"+numbers[i]);
});
document.querySelectorAll(".footnotes_list>li").forEach( (element, i)=>{
    element.setAttribute("id", "footnote_"+numbers[i]);
    element.setAttribute("href", `#fn_${numbers[i]}`)
});

Lets say I do create a 100% working code,

A general audience question remains:

Is it SEO problematic to create footnotes with frontend JavaScript (at least in MediaWiki websites)?

Update for Stephen Ostermiller

I am worried that some search engine crawlers won't read the updated DOM (which allegedly got updated by JavaScript) and that which is different than the HTML source code created from Backend (with the current release of MediaWiki that would be PHP backend) --- an HTML source code that they would most likely read in its whole (unlike the DOM which they might read as a whole).

The main text of the page (the article content, excluding frontend-added footnotes) will indeed remain the same; but this might be a problem in case I have lots of footnotes, especially scientific article citations, and not just one or two "clarifications".

Let along; if the mechanism is frontend for all article webpages whatsoever it might be problematic if it is already problematic for just one page.

8
  • What SEO problems are you worried about? How is this different from using JavaScript for anything else? – Stephen Ostermiller May 24 '20 at 10:05
  • Hello @StephenOstermiller I have updated the question for you in these regards. – George May 24 '20 at 13:19
  • Perhaps backend is better than frontend for SEO at least in the context of adding readable content (such as footnotes). – George May 24 '20 at 13:19
  • It sounds like you are using JavaScript just for updating a tiny piece of the DOM though. The text of the page will remain largely in the HTML source code? – Stephen Ostermiller May 24 '20 at 13:47
  • @StephenOstermiller the main text of the page (the article content, excluding frontend-added footnotes) will indeed remain the same; but this might be a problem in case I have lots of footnotes, especially scientific article citations, and not just one or two "clarifications". – George May 24 '20 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.