Guide
Creating a paginated article list in Drupal 10 with Views
Step‑by‑step guide to build a paginated list of Drupal 10 content using the core Views module, including setup, verification, and recovery.
Published by Tasadduq Burney
09 Jan 2026, 20:23 UTC
4 min131.8K views0

Desired outcome
Create a public‑facing page that displays nodes of a specific content type (e.g., Article) in batches of ten items, with next/previous navigation links provided by Drupal’s core Views pager.
Prerequisites
- A working Drupal 10 installation with the core
Viewsmodule enabled. - At least one content type (e.g.,
Article) that contains a handful of published nodes for testing. - A theme that does not override or hide the Views pager markup (the default themes such as Olivero or Claro work out‑of‑the‑box).
- Access to the Drupal admin interface with the “Administrator” role, or equivalent permissions to create views and clear caches.
- (Optional) Drush 10+ installed and available from the command line for cache rebuilds and configuration export.
Procedure
-
Create the view
- Log in to the admin UI and navigate to Structure → Views → Add new view.
- In the View name field, enter a descriptive name, e.g.,
Article List. - Under Show, select Content of type and choose the content type you want to list (e.g.,
Article). - Check the box Create a page.
- Set the Page title (optional) and the Path where the page will be reachable, e.g.,
/articles. - Leave Display format as Format: HTML list (or choose Table or Grid as preferred) and click Save and edit.
-
Add fields to the view
- In the view editor, locate the FIELDS section and click Add.
- Select the fields you want to display, for example:
Content: TitleContent: Authored byContent: Post date- For each field, configure the label, formatter, and whether to exclude from display (if you only need the value for sorting or filtering).
- Click Apply (all displays) after adding each field.
-
Configure the pager
- In the PAGER section, click the link that reads Use pager: Full pager (if it shows something else, click to change it).
- In the pager settings modal, set Items per page to
10. - Optionally enable Expose items per page widget if you want visitors to choose a different page size.
- Click Apply to save the pager configuration.
-
Save the view
- At the top of the view editor, click Save.
- Drupal will return you to the Views overview page; the new view should appear in the list with a status of Enabled.
-
Verify the page
- Open a browser and navigate to the path you defined, e.g.,
https://example.com/articles. - Confirm that the first ten nodes of the chosen content type appear.
- Check that pagination links (usually labeled “‹ previous” and “next ›”) are present at the bottom of the list.
- Click the “next” link and verify that the next set of up to ten nodes loads without a full page reload error.
- Open a browser and navigate to the path you defined, e.g.,
Expected checks
- HTTP status code 200 for the view page and each paginated request (use browser dev tools → Network tab).
- No PHP warnings or 500 errors in the Drupal watchdog (Reports → Recent log messages).
- The rendered HTML contains a
<ul class="item-list">or equivalent markup for the list items, and a<nav>element with pager links. - If you exposed an items‑per‑page widget, changing the selection updates the
items_per_pagequery parameter and the list length accordingly.
Recovery options
If the view does not behave as expected, you can revert or troubleshoot using the following steps:
- Clear caches – either via the admin UI (Configuration → Development → Performance → Clear all caches) or with Drush:
- Check view status – ensure the view is enabled:
- Verify permissions – the anonymous user (or the role you are testing with) must have the
View published contentpermission for the selected content type. - Inspect for theme overrides – temporarily switch to a core theme (Olivero or Claro) to see if the pager appears; if it does, your custom theme may be hiding it via CSS (
display: none;) or overriding the Views template. - Re‑create the view – if the configuration appears corrupted, delete the view (Structure → Views → Edit → Delete) and repeat the procedure.
- Rollback configuration – if you exported the view to configuration before making changes, you can import it back:
# Run from the Drupal root directory
# Requires file system access and sufficient permissions to execute Drush
drush cr
drush views:list --status
# Export (run once after the view is working)
drush config:export --yes --dependency=views.view.article_list
# To restore later
drush config:import --yes --dependency=views.view.article_list
Limitations and practical verification
- Large result sets can increase memory usage; consider enabling the view’s built‑in caching (Advanced → Caching) or adding exposed filters to limit the dataset.
- Views caching may conflict with aggressive page‑caching strategies (e.g., Internal Page Cache or External CDN). Ensure the view’s cache tags or max‑age align with your site’s performance policy.
- Custom themes sometimes override the Views pager template (
views-view.html.twigorviews-mini-pager.html.twig). If pagination links disappear, inspect the theme’stemplatesdirectory for such overrides. - To verify the pager object programmatically, you can bootstrap Drupal and load the view:
setDisplay('page_1');
$view->execute();
$pager = $view->getPager();
echo 'Total items: ' . $pager->getTotalItems() . PHP_EOL;
echo 'Items per page: ' . $pager->getItemsPerPage() . PHP_EOL;
echo 'Current page: ' . ($pager->getCurrentPage() + 1) . PHP_EOL;
} else {
echo 'View not found.' . PHP_EOL;
}
?>
Run the script from the command line with php script.php. It will output the pager statistics without affecting the live site.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.