Score:0

How to know how many nodes my website has?

vu flag

In /admin/content no specific number of nodes is available.

How to know how many nodes my website has, preferably without installing a module?

I want to know how many nodes I have in general, not of a specific content type.

  • I didn't find any native Drush command.
  • I personally would prefer Bash or JavaScript over PHP to count if I can.
Score:3
in flag

The default /admin/content list is just another view. You can configure that view and temporarily add a result summary widget plugin in the header, which you can configure to get the total (it's the thing you use to render the "Showing X of TOTAL").

somo avatar
vu flag
Yep I picked "Result summary" in the header of the view. Thanks.
Score:2
cn flag

Use an entity query:

$count = \Drupal::entityQuery('node')->accessCheck(FALSE)->count()->execute();

You can run this from a Bash shell with drush ev "..." or in an interactive PHP shell:

drush php
> \Drupal::entityQuery('node')->accessCheck(FALSE)->count()->execute();
= 123
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.