makinacorpus/drupal-static-passthrough

将静态HTML文件直接传递到Drupal 8

dev-master 2023-07-26 09:51 UTC

This package is not auto-updated.

Last update: 2024-09-20 21:27:54 UTC


README

Drupal 8 模块 - 将静态文件直接传递到Drupal 8

默认配置的使用案例

您可以在 config/install/static_passthrough.settings.yml 中查看解释的默认配置。这些设置可以像所有Drupal 8设置一样进行修改/覆盖。

直接传递静态模板

配置

static_passthrough:
  directories:

    ...

    static:
      # Root path to get files
      root_path: 'dev/static'
      # Where to find files to passthrough (relative to DRUPAL_ROOT folder)
      root_dir: 'statics'
      # Who can access these files
      permission: 'access content'
      # Which kind of files are allowed
      allowed_extension: ['html', 'css', 'js', 'png', 'jpg', 'jpeg', 'gif', 'ico', 'ttf', 'otf', 'woff', 'woff2', 'eot' ]
      # Do files have to be include in Drupal structure (false) or displayed alone (true)
      standalone: false

    ...

试试看

  1. DRUPAL_ROOT 目录中创建一个 static 文件夹。
  2. 在其中放置一个名为 test.html 的测试文件,其中包含 <h1>Hello word</h1>
  3. 然后访问 example.com/dev/static/test.html

HTML 将在前端的 Content 区域中打印。

直接传递文档

配置

static_passthrough:
  directories:

    ...

    documentation:
      # Root path to get files
      root_path: 'admin/doc'
      # Where to find files to passthrough (relative to DRUPAL_ROOT folder)
      root_dir: 'docs'
      # Who can access these files
      permission: 'access administration pages'
      # Which kind of files are allowed
      allowed_extension: ['html', 'css', 'js', 'png', 'jpg', 'jpeg', 'gif', 'ico', 'ttf', 'otf', 'woff', 'woff2', 'eot' ]
      # Do files have to be include in Drupal structure (false) or displayed alone (true)
      standalone: true

    ...

试试看

  1. DRUPAL_ROOT 目录中创建一个 docs 文件夹。
  2. 在其中放置一个名为 index.html 的文件,其中包含 <h1>Hello word</h1>
  3. 然后访问 example.com/admin/doc

您将被重定向到独立的 example.com/admin/doc/index.html 文件。