Skip to main content

Filter by Language

You can use the xml:lang attribute to filter content by (natural) language for HTML and PDF outputs. This means you can mark an element as being appropriate for a language, and the element will only be included if the content is published to that language. If you publish to different languages, the element is excluded.

The xml:lang attribute works a little differently to the other filter attributes. Firstly, to use it, you need to enable the feature on the layout that you will use for publishing. Then you can add it to elements that you want to filter, and finally, you publish and choose what languages to publish to. Paligo applies the language filters automatically, based on what languages you are publishing to.

Tip

Use a semi-colon to separate multiple filter values, see Add Multiple Values to an Attribute.

  1. Select Layout in the top menu.

    Paligo editor. The Layout option in the header menu is highlighted.

    Paligo displays a list of Layouts. The list is empty if there are no custom Layouts in your Paligo instance.

  2. Select the Layout you want to update or Create a Layout.

    Tip

    You can copy the URL of the Layout Editor and paste it into a new tab in your browser. This can be useful if you frequently switch between your Paligo content and the Layout settings.

  3. Select Classes and Attributes for HTML layouts OR General > Filtering and Taxonomies for PDF layouts.

  4. Select Enable for Use xml:lang as profiling attribute.

    xml-lang-layout-editor.png
  5. In your content, select an element that you want to filter by language.

  6. Use the Element Attributes Panel to add the xml:lang filter attribute and set its value to the appropriate language. For the language values, use the two-letter language codes, for example, en for English and sv for Swedish.

    Important

    Use the two-letter codes shown in the Languages section (see step 6). Only these two-letter codes are supported. You cannot use alternative language codes.

    xml-lang-attribute-value.png
  7. Repeat steps 3 and 4 for other any other elements you want to filter by language.

  8. Publish your content and choose the layout you edited in step 1 and the language(s) that you want to publish to:

    filter-by-language-language-selection.png
    • If you publish to a language that matches the value of the xml:lang filtered content, that content is included in the output.

    • If you publish to a language that does not match the value of the xml:lang filtered content, that content is excluded from the output.

  9. Set any variables and other profiles as required and then publish.