pr4n4vs/seo-optimizer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

pr4n4vs/seo-optimizer

Composer 安装命令:

composer require pr4n4vs/seo-optimizer

包简介

A Laravel package for SEO optimization.

README 文档

README

SEO Optimizer is a Laravel package designed to enhance SEO by providing easy management of meta tags, sitemaps, and other SEO-related functionalities.

Features

  • Add default SEO meta tags.
  • Customize meta tags (author, description, keywords, etc.).
  • Simple integration into Blade templates.
  • Extendable for more SEO tasks.

Requirements

  • PHP: ^8.1
  • Laravel: ^9.x, ^10.x, ^11.x

Installation

1. Install via Composer

To install the package in your Laravel project, run the following command in your terminal:

composer require pr4n4vs/seo-optimizer:dev-main

2. Publish the Config (Optional)

If you'd like to customize the default settings, publish the config file:

php artisan vendor:publish --tag=seo-optimizer-config

This will create a configuration file located at config/seo-optimizer.php, where you can define default meta tag values and other SEO settings.

3. Autoload the Package

In case the package doesn't autoload automatically, run:

composer dump-autoload

Usage

After installing the package, you can start adding meta tags to your Blade views.

Add Meta Tags in Blade Templates Use the MetaTagManager class to add meta tags in your Blade templates:

@php // Create MetaTagManager instance $metaTagManager = new \Pranav\SeoOptimizer\MetaTagManager();

// Add default meta tags and custom ones
$metaTagManager->addDefaultMeta()->addMeta('author', 'Your Name');

// Render meta tags in HTML
echo $metaTagManager->render();

@endphp This will render basic meta tags like:

Adding Custom Meta Tags You can add more meta tags for descriptions, keywords, etc.:

@php $metaTagManager = new \Pranav\SeoOptimizer\MetaTagManager(); $metaTagManager->addDefaultMeta() ->addMeta('description', 'This is a custom description') ->addMeta('keywords', 'Laravel, SEO, Optimization'); echo $metaTagManager->render(); @endphp

Configuration After publishing the configuration, you can edit it at config/seo-optimizer.php. This file allows you to set:

Default Site Name Default Description Default Keywords And other settings for meta tags.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-10-18