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
其他信息
- 授权协议: Unknown
- 更新时间: 2024-10-18