Extension talk:Cite

About this board

Juandev (talkcontribs)

Does the output follows any citation standard? Is there a possibility to switch between citation standards?

Thiemo Kreuz (WMDE) (talkcontribs)
Reply to "Citation standard"

What is the purpose of <div class="references-small"></div>?

2 (talkcontribs)

Just out of curiosity, did <div class="references-small"></div> once have a purpose?

I could not find it documented anywhere.

Dinoguy1000 (talkcontribs)

Once upon a time it was a class used to make references smaller (as you might've guessed from the name). It was never a feature of Ext:Cite; rather, it was a site-specific class. I don't know about its history here on MediaWiki.org, but on English Wikipedia, the class was removed in 2010 (see here), and I'd imagine it hasn't worked here for a similar period of time. Basically, you can remove this class when you see it.

Reply to "What is the purpose of <div class="references-small"></div>?"

Remove numbering from id/href when reference name is defined

Jiou7 (talkcontribs)

I would like my references/notes to have permalinks, i.e. links which do not change when new references are added. So I was wondering whether there is a possibility to remove the number in id and href when references have name attributes.

Behavior I expect:

- <ref>...</ref> gives href="#cite-note-1" (which is the current behavior)

- <ref name="foo">...</ref> gives href="#cite-note-foo" (instead of href="#cite-note-foo-1" with the current behavior)

This numbering is hardcoded in ReferencesFormatter.php and FootnoteMarkFormatter.php using $val['key'] and $ref['key'] and I do not see any hook or system message able to change that.

Is there a clean way to do this, i.e. without changing Mediawiki core code?

Ancheta Wis (talkcontribs)

The footnote numbering is in order of appearance of the article. You can define a single reference in wikitext thus:

<ref name= foo >[https:theURLhere Your foo content here]</ref> at a single ref occurrence anywhere in the article. Your foo content obeys the rules of wikitext, such as bold, italic, indent, bullet etc. All the other occurrences of that ref content foo are of the form

<ref name= foo /> and the footnotes renumber automatically.

You can then position other copies of ref foo with the wikitext <ref name= foo /> where ever you need in the article. (I use NavPops to check the ref foo content but I have learned that the numbers themselves do not need to be maintained.) Each occurrence of that single foo is distinguished with alphabetical labels. But its footnote number is under program control. Only the name foo is under your control.

I have learned that name= foo works just as well as name="foo" and that camelCaseServesToDistinguish each ref foo namespace.

Thiemo Kreuz (WMDE) (talkcontribs)

What is the purpose of this permalink? What do you want to use it for?

One suggestion I have is to do something like this: <ref><span id="custom_anchor">…</span></ref>. The Wikipedias use templates for this, i.e. Template:Anchor.

Jiou7 (talkcontribs)

Thank you for your answers

@Ancheta Wis I want to keep the seconday numbering you mention when a reference name is used multiple times, but the first numbering seems useless as a given name cannot be used for different references but only to refer to the same reference multiple times. So to be more precise, let us imagine we have the successive ref tags:

- First <ref>...</ref> => gives id ="cite-ref-1"; href="#cite-note-1" . Ok for me

- Then <ref name="foo">...</ref> => gives id="cite-ref-foo_2-0"; href="#cite-note-foo-2" (I would like to have id="cite-ref-foo-0"; href="#cite-note-foo" instead)

- Then <ref name="foo" /> => gives id="cite-ref-foo_2-1"; href="#cite-note-foo-2" (I would like to have id="cite-ref-foo-1"; href="#cite-note-foo" instead)

@Thiemo Kreuz (WMDE) My notes will be used to store additional information which are not just references so I want readers and contributors to be able to share a link to a specific note to share its valuable content.

I want this "permalink" to be created automatically for each named reference. I also want an anchor in the text (where the reference/note will be cited) so I need the second numberig mentionned above. (which is not so doable with templates) The Cite extension already does a lot of the work, so the solution consisting in creating an anchor is not ideal for me.

In fact, I do not understand why the numbering is kept in named references as you cannot use the same name for a different reference so it will necessary be uniue. A secondary numbering is used in the case of multiplle uses of a given reference as mentioned above and it seems sufficient.

Thiemo Kreuz (WMDE) (talkcontribs)

The way the Cite extension works (most notably: the behavior of each element heavily depends on it's position on the page) is quite a beast that's hard to tame. These additional sequence numbers help. I don't know if they are strictly necessary in all situations. Maybe they aren't. But even if, this is impossible to change 15 years and millions of pages later. Sorry. My suggestion is to use a template, e.g. <ref>{{refid|foo|Content of the reference here…}}</ref>.

Jiou7 (talkcontribs)

Thank you for your suggestion. I understand it is impossible to change the default behavior of the Cite extension. But wouldn't it be possible to create hooks or system message to make it parameterizable? For instance, you can alter a reference link with cite_reference_link_key_with_num but unfortunately not enough for my case.

Thiemo Kreuz (WMDE) (talkcontribs)

I had a closer look. Unfortunately, what you want to achieve is currently only possibly by patching the code:

  • In FootnoteMarkFormatter.php change the line with the code snippet $subkey = to $subkey = '';
  • In ReferencesFormatter.php change the line with the code snippet $key . '-' . ( $val['key'] ?? '' ) to $this->anchorFormatter->getReferencesKey( $key ),
Jiou7 (talkcontribs)

Indeed, I modified the core code of Mediawiki but I was looking for a solution which would not imply I have to redo the same modification at each upgrade.

Thank you for your time!

Ancheta Wis (talkcontribs)

My experience is with Wikipedia.en; in this wikipedia, I can define a more slowly varying ref with

<ref name= foo25 group= Bah >The noted [https: Your fooBahContent] </ref>

where each note has a distinguishing name foo1, foo2, .. foo25 etc.

which renders these slowly varying ref foo as [Bah 1], [Bah 2], etc in the body of the article in their own ref list.

Copies of the annotation get referenced as before: <ref name= foo25 group= Bah /> etc. You can intermix [Bah 1] and other refs [1]

But I also have to define a destination at the bottom

{{reflist| name = "Bah"}}

to display the notes at the bottom


  1. The noted Your fooBahContent
  2. More note Their fooBahContent




I don't use visual editor, but I guess I'm learning a little usage here on this mediaWiki talk page.

  1. Your fooBah here

For example, it was not obvious to me that I did not need a reflist template location here. On Wikipedia you have to explicitly position the Bahs to see them.

  1. Ordinary foo
Jiou7 (talkcontribs)

I am not sure I understand how it can solve my problem of primary numbering that I want get rid of. Indeed, the primary numbering is still present in the href and id of notes in your example. Am I missing something?

This post was hidden by Ancheta Wis (history)
Ancheta Wis (talkcontribs)

The visual editor is getting in the way, so I deleted my reply, which had an example. Sorry

Reply to "Remove numbering from id/href when reference name is defined"

Include reference text as text

C holtermann (talkcontribs)

I'm looking for a way to include the text of a reference in the text of the page. I'd like to have something like:

This is a text from [1].

These are some of the books referenced on this page:

  • Some author, Some book [<- This is what I'd like to achieve, identical to what is shown in References]


[1] Some author, Some book

Is there a possibility to achieve that?

Thiemo Kreuz (WMDE) (talkcontribs)

Not with this extension, sorry. You can link to the same reference twice, but it can't be displayed in two different places.

Reply to "Include reference text as text"

referencing footnote at main page in subpage

Gfsamo (talkcontribs)


I have a wiki with several sub-pages. In all sub-pages I need to cite via <ref name="bla" />. I would like to have all cited references (footnotes) only at the main page. Is there any possibility to achieve this.


Adamw (talkcontribs)

Interesting challenge! Perhaps you could put the <references> block in its own subpage, and transclude that into each of the other pages?

Reply to "referencing footnote at main page in subpage"

Why can ref names not be purely numerical?

2 (talkcontribs)

Not that it bothers me, but is there any technical reason for said restriction?

Thiemo Kreuz (WMDE) (talkcontribs)

As far as I can tell from the code, the reason is that refs without a name are automatically numbered, starting from 1. We want to avoid confusion between such automatically numbered and manually named refs.

An additional argument might have been that the (classic) HTML and CSS standards don't allow names, ids and such to start with a number either. It's typically a good idea to follow well-established standards.

Reply to "Why can ref names not be purely numerical?"

Nomination for deletion of Template:Footnote group

Manabimasu (talkcontribs)
Dinoguy1000 (talkcontribs)

What is the point to reposting this notice here? These templates do not appear to exist on MediaWiki.org, and even if they did, their deletion on Wikipedia would not affect their use here.

Reply to "Nomination for deletion of Template:Footnote group"
Gunnar.offel (talkcontribs)

76/5000 I'm looking for a way to use <references> in the parser like

{{#if:<references />| exist | empty }}

i also tried {{#tag:references|}} but it didn't work (i seen working templates here:Editing Template:Reflist ). i tested also to fill in a var and check these, sadly also with no success.

Maybe theres a option to solve this?

Thiemo Kreuz (WMDE) (talkcontribs)

I'm afraid this isn't possible. I can identify 2 problems, and there are probably more:

  1. It's not possible to use the same <references /> tag twice. All later ones will be empty.
  2. The moment the #if is executed, the references block is not filled in yet. There is just a placeholder (called a "marker" in the parser) to be replaced later. This is the same for both {{#if:<references />|… as well as {{#if:{{#tag:references}}|….

I'm not sure what you are referring to in template:reflist. There is, as far as I can tell, no conditional that uses the references tag as a condition.

Gunnar.offel (talkcontribs)

As i said, i tried to use {{#tag:references... like in the linked template for this topic, without success, as you described as point 2.

Then i have to find another solution to hide the Box (a div/table with styles) for the references if it is empty, but with no conditions that sadly wouldn't be that simple.

Thiemo Kreuz (WMDE) (talkcontribs)

What "box"? I think it's better to use CSS for this. You can use <references responsive />, which will give you an extra <div class="mw-references-wrap"> wrapper, which you can style.

Gunnar.offel (talkcontribs)

I know, maybe i can use this to replicate the style. i use <references responsive /> already since it also creates multiple colomns. :)

Since ::before ::after can't inject HTML-elements over CSS it needs a way with js or another idea too, and it isn't useable for templates. For example a unready page in an none-closed project it groups the references in the same boxes like the other infoboxes, that template is used, maybe i can find a way to check the length of the content in these box, to hide the whole if it's empty.

Thiemo Kreuz (WMDE) (talkcontribs)

Ah, what a nice design. Love it!

I found one CSS hack that works. Let's say your wikitext looks like this:

<div class="box">
<references />

In case there are no references, the references tag will not render anything, which means the headline will be the last element in the box. We can use this knowledge:

.box h2:last-child {
	opacity: 0.3;

You could as well use the empty box to mark pages that need sources. ;-)

Reply to "count / parse is possible?"

Impossible to paste from clipboard in version "REL1_33-01ef641"

Mshastchi (talkcontribs)

After updating from version "20e26df" to the above mentioned version I noticed that it is not possible to paste text in the cite input box. After spending much time trying to update parsoid and visualeditor, I found out that downgrading Cite fixes the problem.

Adamw (talkcontribs)

Thanks for taking the time to debug this for us! I've added your report to task T240186, we'll try to prioritize this work. (talkcontribs)

@Mshastchi would you please tell how to downgrade Cite to a version that it works?

Mshastchi (talkcontribs)

Just replace files of the extension with an older version. I used my backup.

Mshastchi (talkcontribs)

There's no problem with mediawiki 1.34 and the latest version of the extension.

Reply to "Impossible to paste from clipboard in version "REL1_33-01ef641""

Cite references link many format backlink

IKhitron (talkcontribs)

Hi. Is the way to configure the backlinks by group? I mean, that for general group, the references will be 1, 2, 3 and the backlinks 1 ^ 1.1, 1.2, 1.3, and for efn group the references will be a, b, c and the backlinks a ^ a.1, a.2, a.3. Now I have references a, b, c and backilnks a ^ 1.1, 1.2, 1.3. Thank you.

Thiemo Kreuz (WMDE) (talkcontribs)

Can you please explain what an "efn" group is, and what you want to achieve?

IKhitron (talkcontribs)

It's my nickname for a group that created by enwiki template:efn. General references are a numbered list 1,2,3, when efn creates a list a,b,c. As above, I'd like to prevent backlinks a ^ 1.1, 1.2, 1.3.

Thiemo Kreuz (WMDE) (talkcontribs)
IKhitron (talkcontribs)

So, I wasn't clear. I do not talk about enwiki or template efn. As I already said, it's just a nickname, instead of sying every second "a group lower-alpha".

Thiemo Kreuz (WMDE) (talkcontribs)

I'm afraid it's still not clear what you are talking about, and what you want. What do you mean when you say "nickname"? What do you mean when you say you want to "prevent backlinks"? Can you please show the code you are currently using?

The special behavior of a <ref group="lower-alpha"> only works if a page MediaWiki:Cite link label group-lower-alpha exists. This is not the case by default, unless you created it.

The magic of templates like efn, notelist and reflist only works together with a list-style-type: inherit override in Common.css. That's something the English Wikipedia community came up with, not something the Cite extension officially supports.

IKhitron (talkcontribs)

The special behavior you described already exists in our wiki, a lot of time. There is a template, named on our wiki language, let's call it templateA for this discussion, that creates lower-alpha reference, as efn in enwiki. There is another template, let's call it templateList, that creates references group=lower-alpha. As a result, I can write wiki code

text1{{templateA|name=ref25|text2}}text3{{templateA|name=ref25}}text4<ref name=ref35>text5</ref>text6<ref name=ref35/>text7


1 ^ 1.1 1.2 text5
a ^ 1.1 1.2 text2

when I'd like to get

1 ^ 1.1 1.2 text5
a ^ a.1 a.2 text2

when the differences are in the last line only, 1.1 1.2 vs a.1 a.2.

Thiemo Kreuz (WMDE) (talkcontribs)

I'm sorry, but such a degree of customization is not possible.

As said, the customized "a" in your example is a hack in your Common.css and the template you are using, and not officially supported by the Cite extension.

IKhitron (talkcontribs)

I see. A pity. And there is no way to change "1.0 1.1 1.2" even to "0 1 2"?

IKhitron (talkcontribs)
Thiemo Kreuz (WMDE) (talkcontribs)

Yes, that should work. Note you need to do both changes I listed above.

IKhitron (talkcontribs)

Very well. Thanks a lot for your help and for your time.

IKhitron (talkcontribs)

Well, I tried, and it does not work. Maybe it takes time, as for gadgets, or I should do something more? Thanks.

IKhitron (talkcontribs)
IKhitron (talkcontribs)

Please, somebody, help. Thank you.

Thiemo Kreuz (WMDE) (talkcontribs)

You are not providing any new information. So I don't know to what I should respond to. I believe I already explained all I know in my posts above.

IKhitron (talkcontribs)

"Well, I tried, and it does not work" is the information. So I've asked if I should do more steps. For example, create another page, or turn on some extension.

Thiemo Kreuz (WMDE) (talkcontribs)
IKhitron (talkcontribs)

Well, found the problem. And I do not like the answer. Every page in Wikipedia should be purged to start this working on it.

Reply to "Cite references link many format backlink"
Return to "Cite" page.