ITADN

feat: skip minify for LD+JSON

#40Pull RequestStephaneBour 创建于 2025-06-23
S
StephaneBourcommented
**Problem** Currently, Laravel Minify processes all <script> tags including <script type="application/ld+json"> tags. LD+JSON scripts contain structured data that should remain readable and unminified for SEO purposes and search engine crawlers. Minifying these scripts can break the structured data format and negatively impact SEO. **Solution** This PR adds a new configuration option skip_ld_json that allows users to automatically skip minification of <script type="application/ld+json"> tags while still minifying regular JavaScript code. **Changes Made** - Configuration Added skip_ld_json option to config/minify.php (default: true) Added MINIFY_SKIP_LD_JSON environment variable support - Core Logic Modified MinifyJavascript middleware to check script type before minification Added isLdJsonScript() method for case-insensitive detection of LD+JSON scripts Scripts with type="application/ld+json" are now skipped when option is enabled
合并状态:未合并 关闭于 2025-07-07 4 条评论