1.0.0 • Public • Published 4 years ago
Chú ý
- Thêm vào config/app.php trong mục providers: `Modules\Seo\Providers\SeoServiceProvider::class`
1. Cài đặt OptionEditor từ Clara App Store
Thêm các bản ghi meta theo lần lượt các Type:
- general.logo
- home (default meta)
- category
- product
- news
- archive
- search
- với value {"title":"{name} | Printerval","keywords":"","description":""}
hoặc có thể chạy SQL sau để insert sau đó edit theo ý muốn của mình
INSERT INTO `sb_option`(`name`, `key`, `value`, `type`) VALUES ('Default Image', 'general.logo', 'https://printerval.com/files/printerval-5ffbea9b10eff.png', NULL);
INSERT INTO `sb_option`(`name`, `key`, `value`, `type`) VALUES ('Meta Data', 'home', '{\"title\":\"T-Shirts Starting at $14 Featuring Your Favorite TV Shows, Movies, Comics, and More | Printerval\",\"keywords\":\"\",\"description\":\"Shop Art, T-Shirts and Other Apparel Created by a Global Community of Independent Designers\"}', 'json');
INSERT INTO `sb_option`(`name`, `key`, `value`, `type`) VALUES ('Meta Data', 'category', '{\"title\":\"{name} | Printerval\",\"keywords\":\"\",\"description\":\"{name} Be Unique. Shop t-shirts created by independent artists from around the globe. We print the highest quality t-shirts on the internet\"}', NULL);
INSERT INTO `sb_option`(`name`, `key`, `value`, `type`) VALUES ('Meta Data', 'product', '{\"title\":\"{name} | Printerval\",\"keywords\":\"\",\"description\":\"\"}', NULL);
INSERT INTO `sb_option`(`name`, `key`, `value`, `type`) VALUES ('Meta Data', 'news', '{\"title\":\"{name} | Printerval\",\"keywords\":\"\",\"description\":\"\"}', NULL);
INSERT INTO `sb_option`(`name`, `key`, `value`, `type`) VALUES ('Meta Data', 'archive', '{\"title\":\"{name} | Printerval\",\"keywords\":\"\",\"description\":\"\"}', NULL);
INSERT INTO `sb_option`(`name`, `key`, `value`, `type`) VALUES ('Meta Data', 'search', '{\"title\":\"{name} | Printerval\",\"keywords\":\"\",\"description\":\"\"}', NULL);
INSERT INTO `sb_option`(`name`, `key`, `value`, `type`) VALUES ('Meta Data', 'post', '{\"title\":\"{name} | Printerval\",\"keywords\":\"\",\"description\":\"\"}', NULL);
ngoài ra có thể cấu hình các biến {store} hoặc {store_name} để thay thế các variable như trang category, product, news...
2. Tại các controller của từng page cần declare những biến sau để ưu tiên nhận Meta Data
- $metaTitle
- $metaDescription
- $metaKeywords
- $metaImage
3. Nếu không cấu hình, hệ thống sẽ tự pick meta data của trang home. Muốn cấu hình meta cho URL nào chỉ càn thêm SQL bên trên thay đổi type và đặt route name trùng với type.
Hướng dẫn sửa dụng tool redirect
Thêm middleware SeoRedirectMiddleware vào fontend middleware group
\Modules\Seo\Middlewares\SeoRedirectMiddleware::class