Macro include or display - to exclude first heading it must be a H1

Hi.

We currently facing a little problem. Because of a11y reasons we don’t use H1 in articles as the title is one H1 (and there should be only one). But if we want to omit the first heading of an article in include or display macro it won’t work. It will only work if this first heading is an H1 or = Heading =.

I know there is a current discussion on what to do in general with the headings in articles. If we don’t want to wait for that solution (and its enrollment in our wiki) has someone an idea how we can fix this?

Regards, Simpel

Hello I don’t understand why you want to omit the first heading when including a page since you don’t use level 1 headings in pages. In any case you can use the section parameter of the include macro to include a section (not sure if that’s what you want though).

The page embedding the included page is using it’s own heading for this part. Not my style but it’s valid I think.

I tried to use the section and put in the H-id of the heading. But then I face another issue: the moment I have a white space in the heading only the first word is hidden. The rest of the heading is pure text w/o any html tag around.

Funny there: include inserts an non breaking space after the first white space display not.

Ok, then the section parameter from the include macro seems to be exactly what you need.

Can you provide an example so that we can reproduce? (I don’t understand what you mean).

The page to be included/displayed:

image

with this xwiki syntax:

== H2 with white space ==

And this is just a text in a paragraph.

The page including / displaying the section:

image

with this xwiki syntax:

== **Include** macro with ID HH2withwhitespace ==

{{include reference="pagetoinclude.WebHome" excludeFirstHeading="true" section="HH2withwhitespace"/}}

== **Display **macro with ID HH2withwhitespace ==

{{display reference="pagetoinclude.WebHome" excludeFirstHeading="true" section="HH2withwhitespace"/}}

Now I don’t see the non breaking space. But you see the words “with white space” which come from the heading of the page to be included / displayed.

I’ve just tried it and it works well for me on XWiki 17.5.0. This looks like a bug that must have been fixed. What version are you using?

We’re on XWiki 15.10.13.

Ok. This is pretty old and no longer supported at the community level. Could you try upgrading or at least try locally with a more recent xwiki version? Thx

See XWIKI-18687, this has been fixed already some months ago.