# Improve the Encyclopedia template

**URL:** <https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231>\
**Category:** Development\
**Tags:** proposal\
**Created:** [October 5, 2023, 6:09pm UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231 "2023-10-05T18:09:23Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mflorea](https://forum.xwiki.org/user_avatar/forum.xwiki.org/mflorea/32/49_2.png) [@mflorea](https://forum.xwiki.org/u/mflorea)\
**Post date:** [October 5, 2023, 6:09pm UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/1 "2023-10-05T18:09:24Z")

</div>

Hi everyone,

The Encyclopedia template is one of the [few templates](https://extensions.xwiki.org/xwiki/bin/view/Extension/Templates%20Application/) we bundle in XWiki Standard. While working on [XWIKI-20712](https://jira.xwiki.org/browse/XWIKI-20712) I noticed that it has some issues:

- The text doesn’t extend below the boxes on the right. The template basically has two columns, but the second (right) “column” (with the boxes) is most of the time way shorter than the first. This means there is a lot of space lost on the second column, below the boxes. I know that long lines of text are harder to read than short-width columns, but I don’t think this was the purpose here (to make the “content column” thinner). As its name suggests, the template is actually trying to provide a layout similar to the one from Wikipedia, where the text is expanding below the right boxes.
- Sections titles are missing the Edit pencil icon, because the headings are wrapped in some `DIV` HTML tags.
- The wiki syntax is using the group XWiki syntax `(% class="box" %)(((...)))` instead of the [Box macro](https://extensions.xwiki.org/xwiki/bin/view/Extension/Box%20Macro), probably because the Box macro was not editable in-line when this template was written.
- The wiki syntax is more complex than it should be, making it harder to edit with the WYSIWYG editor. In general, CKEditor editing experience when your content has `DIV` tags is not the best, so we should try to avoid it, if possible. It’s fine when those `DIV` tags come from a macro (ideally editable inline), because they are read-only.

I’d like to update the content of the Encyclopedia template to fix the mentioned issues:

- use the Box macro for the right boxes
- wrap the 2 right boxes in a `floatinginfobox` DIV, so that the text extends below them
  - Remove the top margin (6px) from the `floatinginfobox` to align it with the content of the left. I think this makes sense in all cases when `floatinginfobox` is used.
  - Increase the left and bottom margin to match the ` @grid-gutter-width`. I think it makes sense to have this kind of spacing for the `floatinginfobox` in general.

- improve the styling so that the background color of the jumbotron doesn’t go below the right boxes

```auto
.floatinginfobox + .jumbotron {
  overflow-x: auto;
}

```

- Remove unnecessary DIV wrappers from the content, so that sections get their edit icon.

The result:

- Before  
 ![Encyclopedia-Template-before](https://forum.xwiki.org/uploads/default/original/2X/c/c9599d464c5c0e7ccf1c8acaa91af14e86fa850a.png)
- After  
 ![Encyclopedia-Template-after](https://forum.xwiki.org/uploads/default/original/2X/4/4120eb4e60a5d9772ffc9ec7ca3fa68bef828d87.jpeg)

Note that this also improves the result in the PDF export.

- Before  
 ![Encyclopedia-Template-PDF-before](https://forum.xwiki.org/uploads/default/original/2X/f/f9babd600e864e67596d918e6fc33edabfe68f65.png)
- After  
 ![Encyclopedia-Template-PDF-after](https://forum.xwiki.org/uploads/default/original/2X/c/c4df107f75314809fd517121880e13c2f0bd3ee9.jpeg)

WDYT?

Thanks,  
Marius

---

<div class="post-metadata">

**Author:** ![lucaa](https://forum.xwiki.org/user_avatar/forum.xwiki.org/lucaa/32/2537_2.png) [@lucaa](https://forum.xwiki.org/u/lucaa)\
**Post date:** [October 5, 2023, 8:02pm UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/2 "2023-10-05T20:02:52Z")

</div>

What a good idea, +1!

2 concerns, though:

- ideally, the template should be something reproducible by a user using a wysiwyg editor (actually, I think we may have voted on this in the past…). It was not the case before and it will probably not be the case now, but I guess it gets closer and closer. I was thinking that if we change it, we could try to bring it the closest possible to something do-able with the editor.
- I’m wondering what kind of impact this could have on upgrade, and I can think of 2 situations:
  - on a wiki intensively using the template, they will end-up with 2 “generations” of pages, one from before the upgrade and one from after. This corpus won’t behave in a unitary way (editing will be different, pdf print will be different, etc), which may be difficult to understand by regular users (not admins)
    - I am wondering what way out there is? Could we even think about any form of “migration” ? Probably not…

- if anyone has written any custom CSS for this, it won’t apply the same (after upgrade or on a mixed corpus), but this is a more rare situation and it can be relatively easily fixed.

Thanks,  
Anca

---

<div class="post-metadata">

**Author:** ![mflorea](https://forum.xwiki.org/user_avatar/forum.xwiki.org/mflorea/32/49_2.png) [@mflorea](https://forum.xwiki.org/u/mflorea)\
**Post date:** [October 6, 2023, 6:05am UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/3 "2023-10-06T06:05:51Z")

</div>

> [@lucaa](#):
>
> ideally, the template should be something reproducible by a user using a wysiwyg editor (actually, I think we may have voted on this in the past…). It was not the case before and it will probably not be the case now, but I guess it gets closer and closer. I was thinking that if we change it, we could try to bring it the closest possible to something do-able with the editor.

I agree it would be nice to be able to re-create this template from the WYSIWYG editor. With the new version I’m proposing there are only two things missing:

- a floating box macro, editable in-line
- a [jumbotron](https://getbootstrap.com/docs/3.4/components/#jumbotron) macro, also editable in-line

Both should be easy to implement, provided we don’t add too many parameters.

> [@lucaa](#):
>
> I’m wondering what kind of impact this could have on upgrade, and I can think of 2 situations:
> 
> - on a wiki intensively using the template, they will end-up with 2 “generations” of pages, one from before the upgrade and one from after. This corpus won’t behave in a unitary way (editing will be different, pdf print will be different, etc), which may be difficult to understand by regular users (not admins)
> - I am wondering what way out there is? Could we even think about any form of “migration” ? Probably not…

There are two problems:

1. We don’t know if a page was created with such a template or not. There is a `template` field in `XWikiDocument` but

2. Even if we could query the pages that were created with this template, we couldn’t do much because the layout is not enforced in any way. The user is free to change it, because it’s part of the content. So even if a page was created initially from the Encyclopedia template, the user may have removed all the content and transformed the page into completely something else. Thus, I don’t see how we could implement a migration.

> [@lucaa](#):
>
> if anyone has written any custom CSS for this, it won’t apply the same (after upgrade or on a mixed corpus), but this is a more rare situation and it can be relatively easily fixed.

Not exactly. The only big change I’m proposing is to replace the usage of Bootstrap grid (columns) with a floating box. The jumbotron at the top of the page and the boxes on the right are the same. So if someone has styled them (not inline from the content, obviously) then those styles should be preserved. And they should be preserved even if we introduce the floating box and jumbotron macros, since they will generate the same HTML structure.

Thanks for the feedback,  
Marius

---

<div class="post-metadata">

**Author:** ![mflorea](https://forum.xwiki.org/user_avatar/forum.xwiki.org/mflorea/32/49_2.png) [@mflorea](https://forum.xwiki.org/u/mflorea)\
**Post date:** [October 6, 2023, 6:08am UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/4 "2023-10-06T06:08:10Z")

</div>

> [@mflorea](#):
>
> I agree it would be nice to be able to re-create this template from the WYSIWYG editor. With the new version I’m proposing there are only two things missing:
> 
> - a floating box macro, editable in-line
> - a [jumbotron](https://getbootstrap.com/docs/3.4/components/#jumbotron) macro, also editable in-line
> 
> Both should be easy to implement, provided we don’t add too many parameters.

Should I also implement these 2 macros as part of the proposed changes? What do the others think?

Thanks,  
Marius

---

<div class="post-metadata">

**Author:** ![lucaa](https://forum.xwiki.org/user_avatar/forum.xwiki.org/lucaa/32/2537_2.png) [@lucaa](https://forum.xwiki.org/u/lucaa)\
**Post date:** [October 6, 2023, 7:34am UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/5 "2023-10-06T07:34:14Z")

</div>

> [@mflorea](#):
>
> The only big change I’m proposing is to replace the usage of Bootstrap grid (columns) with a floating box. The jumbotron at the top of the page and the boxes on the right are the same. So if someone has styled them (not inline from the content, obviously) then those styles should be preserved.

You said you removed some containers also, so it may have an impact depending on how the CSS was wrote, but well, it needs to be some bad CSS and I agree that it’s a corner case, let’s not spend too much time on it.

> [@mflorea](#):
>
> wrap the 2 right boxes in a `floatinginfobox` DIV, so that the text extends below them

Actually, I just thought of it, could you also make the floatinginfobox mobile-friendly while at it?  
IIRC it was not the best layout on all screen sizes…

Thanks,  
Anca

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [October 9, 2023, 8:56am UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/6 "2023-10-09T08:56:33Z")

</div>

Sounds good, thanks @mflorea

---

<div class="post-metadata">

**Author:** ![mflorea](https://forum.xwiki.org/user_avatar/forum.xwiki.org/mflorea/32/49_2.png) [@mflorea](https://forum.xwiki.org/u/mflorea)\
**Post date:** [October 9, 2023, 11:43am UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/7 "2023-10-09T11:43:10Z")

</div>

> [@lucaa](#):
>
> Actually, I just thought of it, could you also make the floatinginfobox mobile-friendly while at it?  
> IIRC it was not the best layout on all screen sizes…

The easiest is to disable the floating on small screens. I can do that.

---

<div class="post-metadata">

**Author:** ![lucaa](https://forum.xwiki.org/user_avatar/forum.xwiki.org/lucaa/32/2537_2.png) [@lucaa](https://forum.xwiki.org/u/lucaa)\
**Post date:** [October 9, 2023, 1:35pm UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/8 "2023-10-09T13:35:44Z")

</div>

yes, this is what I meant. Depending on the size of the floating box, on some screens it should just be not floating.

---

<div class="post-metadata">

**Author:** ![gtothill](https://forum.xwiki.org/user_avatar/forum.xwiki.org/gtothill/32/3246_2.png) [@gtothill](https://forum.xwiki.org/u/gtothill)\
**Post date:** [March 20, 2025, 1:53pm UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/9 "2025-03-20T13:53:33Z")

</div>

I found this discussion as I was looking for an easy way of changing the right sided column and boxes. The suggested changes were just what I was looking for. May I ask - was this developed in the end?

---

<div class="post-metadata">

**Author:** ![mflorea](https://forum.xwiki.org/user_avatar/forum.xwiki.org/mflorea/32/49_2.png) [@mflorea](https://forum.xwiki.org/u/mflorea)\
**Post date:** [March 20, 2025, 2:09pm UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/10 "2025-03-20T14:09:52Z")

</div>

> [@gtothill](#):
>
> was this developed in the end?

The changes were pushed to a branch that hasn’t been merged yet. See [Comparing master...XWIKI-21419 · xwiki/xwiki-platform · GitHub](https://github.com/xwiki/xwiki-platform/compare/master...XWIKI-21419) . There are quite a few changes because [Loading...](https://jira.xwiki.org/browse/XWIKI-21420) was mixed with [Loading...](https://jira.xwiki.org/browse/XWIKI-21419) . So the changes in that branch are moving the Templates Application into XWiki Platform and also improve the Encyclopedia template. Note that 2 CSS changes are needed (in `messages.less` and `misc.less`) in order for the Encyclopedia template to look OK with the updated content.

Hope this helps,  
Marius

---

<div class="post-metadata">

**Author:** ![gtothill](https://forum.xwiki.org/user_avatar/forum.xwiki.org/gtothill/32/3246_2.png) [@gtothill](https://forum.xwiki.org/u/gtothill)\
**Post date:** [March 20, 2025, 2:40pm UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/11 "2025-03-20T14:40:00Z")

</div>

Hi Marius. Thanks - That’s very helpful. Im reluctant to try and merge those changes myself because I dont want to break the normal upgrade cycle (and probably would break something along the way anyway). I noticed that your last commit was a year ago. I wondered if there was a timeline for merge given the other changes required?

---

<div class="post-metadata">

**Author:** ![mflorea](https://forum.xwiki.org/user_avatar/forum.xwiki.org/mflorea/32/49_2.png) [@mflorea](https://forum.xwiki.org/u/mflorea)\
**Post date:** [March 20, 2025, 3:03pm UTC](https://forum.xwiki.org/t/improve-the-encyclopedia-template/13231/12 "2025-03-20T15:03:08Z")

</div>

> [@gtothill](#):
>
> I wondered if there was a timeline for merge given the other changes required?

There’s no timeline, unfortunately. It’s on my TODO list, but not on top of it ☹ . The merge was put on hold because there wasn’t an agreement on where to move the Template Application in XWiki Platform (how to reorganize the code), or if we should move it or not.
