CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-gatsby-source-drupal

Gatsby source plugin for building websites using the Drupal CMS as a data source

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

configuration.mddocs/

Plugin Configuration

Comprehensive configuration options for gatsby-source-drupal plugin to control connection settings, authentication, performance, and feature toggles.

Capabilities

Core Connection Options

Essential configuration for connecting to your Drupal instance.

/**
 * Required base URL of your Drupal instance
 */
baseUrl: string;

/**
 * Optional CDN URL equivalent to your baseUrl for faster content delivery
 */
proxyUrl?: string;

/**
 * Path to the JSON:API root endpoint
 * @default "jsonapi"
 */
apiBase?: string;

Usage Examples:

// Basic configuration
{
  resolve: `gatsby-source-drupal`,
  options: {
    baseUrl: `https://your-drupal-site.com/`,
  },
}

// With CDN and custom API base
{
  resolve: `gatsby-source-drupal`,
  options: {
    baseUrl: `https://your-drupal-site.com/`,
    proxyUrl: `https://cdn.example.com/`,
    apiBase: `api/v1`,
  },
}

Authentication Options

Configure authentication for protected Drupal sites.

/**
 * Basic HTTP authentication credentials
 */
basicAuth?: {
  username: string;
  password: string;
};

/**
 * Custom HTTP headers for requests
 */
headers?: Record<string, string>;

/**
 * Additional GET parameters for all requests
 */
params?: Record<string, string>;

/**
 * Secret token for webhook security
 */
secret?: string;

Usage Examples:

{
  resolve: `gatsby-source-drupal`,
  options: {
    baseUrl: `https://protected-site.com/`,
    basicAuth: {
      username: process.env.BASIC_AUTH_USERNAME,
      password: process.env.BASIC_AUTH_PASSWORD,
    },
    headers: {
      'Accept': 'application/vnd.api+json',
      'Custom-Header': 'value',
    },
    params: {
      'api-key': process.env.DRUPAL_API_KEY,
    },
    secret: process.env.PREVIEW_SECRET,
  },
}

Performance Options

Configuration options to optimize build performance and resource usage.

/**
 * Number of concurrent file download requests
 * @default 20
 */
concurrentFileRequests?: number;

/**
 * Number of concurrent API requests to Drupal
 * @default 20
 */
concurrentAPIRequests?: number;

/**
 * Request timeout in milliseconds
 * @default 30000
 */
requestTimeoutMS?: number;

Usage Examples:

{
  resolve: `gatsby-source-drupal`,
  options: {
    baseUrl: `https://your-site.com/`,
    concurrentFileRequests: 60,
    concurrentAPIRequests: 10,
    requestTimeoutMS: 60000,
  },
}

Content Filtering Options

Control which content is fetched from Drupal to optimize build times.

/**
 * JSON:API filters to limit data retrieval per collection
 */
filters?: Record<string, string>;

/**
 * Link types to skip during data fetching
 * @default ["self", "describedby", "contact_message--feedback", "contact_message--personal"]
 */
disallowedLinkTypes?: string[];

Usage Examples:

{
  resolve: `gatsby-source-drupal`,
  options: {
    baseUrl: `https://your-site.com/`,
    filters: {
      // Only fetch published articles
      'node--article': 'filter[status][value]=1',
      // Only fetch active files
      'file--file': 'filter[status][value]=1',
    },
    disallowedLinkTypes: [
      'self',
      'describedby',
      'node--page', // Skip page nodes
    ],
  },
}

File and Image Options

Configure file downloading and image processing behavior.

/**
 * Skip downloading files from Drupal (useful with Image CDN)
 * @default false
 */
skipFileDownloads?: boolean;

/**
 * Enable Gatsby Image CDN for optimized image processing
 * @default true
 */
imageCDN?: boolean;

/**
 * Machine name of the Drupal image style for placeholders
 * @default "placeholder"
 */
placeholderStyleName?: string;

Usage Examples:

{
  resolve: `gatsby-source-drupal`,
  options: {
    baseUrl: `https://your-site.com/`,
    skipFileDownloads: true,
    imageCDN: true,
    placeholderStyleName: 'custom_placeholder',
  },
}

Build Optimization Options

Options for incremental builds and development workflow optimization.

/**
 * Enable FastBuilds for incremental content updates
 * @default false
 */
fastBuilds?: boolean;

/**
 * Prefix for GraphQL type names to avoid conflicts
 */
typePrefix?: string;

/**
 * Entity types that use revision IDs for relationships
 * @default []
 */
entityReferenceRevisions?: string[];

Usage Examples:

{
  resolve: `gatsby-source-drupal`,
  options: {
    baseUrl: `https://your-site.com/`,
    fastBuilds: true,
    typePrefix: 'Drupal',
    entityReferenceRevisions: ['paragraph'],
  },
}

Language Configuration

Comprehensive multilingual support configuration.

/**
 * Language configuration for multilingual sites
 */
languageConfig?: {
  /** Default language code */
  defaultLanguage: string;
  /** Array of enabled language codes or renamed language objects */
  enabledLanguages: (string | { langCode: string; as: string })[];
  /** Filter API responses by current language */
  filterByLanguages?: boolean;
  /** Entity types that support translation */
  translatableEntities: string[];
  /** Entity types that don't support translation */
  nonTranslatableEntities: string[];
};

Usage Examples:

{
  resolve: `gatsby-source-drupal`,
  options: {
    baseUrl: `https://multilingual-site.com/`,
    languageConfig: {
      defaultLanguage: 'en',
      enabledLanguages: [
        'en',
        'fr', 
        'es',
        // Renamed language code
        { langCode: 'en-gb', as: 'uk' },
      ],
      filterByLanguages: true,
      translatableEntities: ['node--article', 'node--page'],
      nonTranslatableEntities: ['file--file', 'taxonomy_term--tags'],
    },
  },
}

Complete Configuration Example

// Complete gatsby-config.js example
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-drupal`,
      options: {
        // Connection
        baseUrl: `https://your-drupal-site.com/`,
        proxyUrl: `https://cdn.example.com/`,
        apiBase: `jsonapi`,
        
        // Authentication
        basicAuth: {
          username: process.env.BASIC_AUTH_USERNAME,
          password: process.env.BASIC_AUTH_PASSWORD,
        },
        headers: {
          'Accept': 'application/vnd.api+json',
        },
        secret: process.env.PREVIEW_SECRET,
        
        // Performance
        concurrentFileRequests: 30,
        concurrentAPIRequests: 15,
        requestTimeoutMS: 45000,
        
        // Content
        filters: {
          'node--article': 'filter[status][value]=1',
          'file--file': 'filter[status][value]=1',
        },
        disallowedLinkTypes: [
          'self',
          'describedby',
          'contact_message--feedback',
        ],
        
        // Files and Images
        skipFileDownloads: true,
        imageCDN: true,
        placeholderStyleName: 'placeholder',
        
        // Build Optimization
        fastBuilds: true,
        typePrefix: 'Drupal',
        entityReferenceRevisions: ['paragraph'],
        
        // Multilingual
        languageConfig: {
          defaultLanguage: 'en',
          enabledLanguages: ['en', 'fr', 'es'],
          filterByLanguages: false,
          translatableEntities: ['node--article'],
          nonTranslatableEntities: ['file--file'],
        },
      },
    },
  ],
}

docs

configuration.md

data-sourcing.md

file-handling.md

incremental-builds.md

index.md

multilingual.md

tile.json