Site Building

6.11. Changing Content Display for Drupal 8, 9, and 10

Goal

Make the content items more readable, accessible, and visibly attractive by reordering the fields, hiding labels, and tuning the output of the fields.

Site prerequisites

The Vendor content type must exist, it must have Main Image and Vendor URL fields, and your site must have at least one Vendor content item. See Section 6.1, “Adding a Content Type”, Section 6.3, “Adding Basic Fields to a Content Type”, and Section 5.2, “Creating a Content Item”.

Steps

Sprout Video
  1. Find and view a Vendor content item you created in Section 6.3, “Adding Basic Fields to a Content Type”. Notice that there are several things that could be done to improve how the page looks:

    • The Main Image and Vendor URL fields should not have labels.
    • The order of the fields should be changed so that the image comes first.
    • The image should be smaller.
  2. To fix the first two problems, and update some additional settings, in the Manage administrative menu, navigate to Structure > Content types (admin/structure/types). Then click Manage display in the dropdown button for the Vendor content type.

    Image
    Manage display

  3. Under the Label column, select Hidden for Main image. Do the same for Vendor URL.

    Image
    Selecting main image title as hidden

  4. Click the gear wheel for the Vendor URL field, to open the configuration options.
  5. Fill in the fields as shown below.

    Field name Explanation Example value

    Trim link text length

    Maximum displayed length for link text

    Blank (no trimming)

    Open link in new window

    Whether links should open in a new window or the same window

    Checked

    Image
    Link trim length

  6. Click Update.
  7. Drag the cross bar handles of the fields to reorder as Main image, Body, Vendor URL, and Links. As an alternative to dragging, you can click the Show row weights link at the top of the table and enter numerical weights (fields with lower or more negative weights will be shown first).

    Image
    Changing order of fields

  8. Click Save.
  9. Find the Vendor content item from step 1 again, and verify that the updates have been made.
  10. Repeat similar steps to manage the display of the Recipe content type fields.

Expand your understanding