Problem/Motivation

The module currently provides a bulk ZIP download action from the admin UI, but there is no way to export content programmatically from the command line. This makes it difficult to automate exports as part of CI/CD pipelines, AI ingestion workflows, or scheduled batch processes.

Proposed resolution

Add a new Drush command content-first:export that exports node content as Markdown files to a local folder, reusing the existing content_first.builder and content_first.filename_helper services.

Command signature

drush content-first:export [options]
Options
Option Default Description
--entity node Entity type to export. Only node is currently supported.
--bundles (all) Comma-separated list of bundle machine names to filter by.
--status (all) Publication status: 1 = published, 0 = unpublished.
--language (all) Comma-separated list of language codes to export.
--folder (cwd) Output folder path. Created automatically if it does not exist.
Behaviour
Each node translation is exported as a separate .md file.
Filenames are generated by the existing ContentFirstFilename service (language-prefixed URL alias, e.g. en_articles_my-post.md).
File content is the output of RenderedContent::getMarkdown(), matching what the ZIP download action produces.
Translations for which buildContent() returns null are skipped with a warning.
All filters can be combined freely.
Usage examples

# Export all nodes in all languages to the current directory
drush content-first:export

# Export only published articles and basic pages
drush content-first:export --bundles=article,page --status=1

# Export English and Spanish translations only
drush content-first:export --language=en,es

# Export to a specific folder
drush content-first:export --folder=/var/exports/content

# Combine filters
drush content-first:export --bundles=article --status=1 --language=en --folder=/var/exports
Implementation
Two new files are added to the module:

src/Commands/ContentFirstCommands.php — the command class, registered as a Drush service.
drush.services.yml — service definition tagged with drush.command.
A unit test (tests/src/Unit/ContentFirstCommandsTest.php) covers option parsing, query conditions, translation filtering, file writing, and all early-return paths.

API changes

No changes to existing APIs. Two new files added.

Data model changes

None.

CommentFileSizeAuthor
#5 content_first_export.png394.29 KBeduardo morales alberti
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gedur created an issue. See original summary.

gedur’s picture

Status: Active » Needs review

please review

eduardo morales alberti made their first commit to this issue’s fork.

eduardo morales alberti’s picture

StatusFileSize
new394.29 KB

Ready:
Content first export

eduardo morales alberti’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.