承接 axllent/silverstripe-links-to-blank 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

axllent/silverstripe-links-to-blank

Composer 安装命令:

composer require axllent/silverstripe-links-to-blank

包简介

Extension to add add target="_blank" to all outgoing links & downloads

README 文档

README

This module enhances your HTML output by automatically adding target="_blank" to all outgoing links and internal "download links" (e.g., PDF, ZIP, TAR, DOC, PPT, and Excel files).

Earlier versions of this module used JavaScript for similar functionality, but that approach caused compatibility issues with tools like the Wayback Machine.

Features

  • Automatically adds target="_blank" to outgoing and internal file links.
  • Includes rel="noopener" to outgoing links to prevent cross-site exploits.
  • Optionally adds rel="nofollow" and rel="noreferrer" to outgoing links.
  • Allows adding custom CSS classes to file and external links for styling.
  • Supports adding additional file extensions for custom file types.

Requirements

  • Silverstripe ^4 || ^5 || ^6

Installation

composer require axllent/silverstripe-links-to-blank

After installation ensure you have done a ?flush. No further configuration is required.

Usage

To customise the module, you can define your own configuration:

Axllent\LinksToBlank\Middleware:
    ## Specify additional external hosts to exclude from processing.
    ## The current host is automatically excluded.
    ignore_hosts:
        - "www.example.com"

    ## Exclude links with this CSS class from being parsed (default: none).
    ignore_css_class: "ignore-link"

    ## Add a CSS class to all external links (default: none).
    add_css_external: "external-link"

    ## Add a CSS class to all file links (default: none).
    add_css_files: "download-link"

    ## Define custom file types to be treated as file links.
    ## Each file type should include the leading dot.
    add_file_extensions:
        - ".ext"

    ## Add rel="nofollow" to all external links (default: false).
    nofollow: true

    ## Add rel="noreferrer" to all external links (default: false).
    noreferrer: true

统计信息

  • 总下载量: 2.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-02-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固