useSeo.ts 647 B

1234567891011121314151617181920212223242526
  1. // import { useSeoMeta } from '#imports'; // Nuxt 3 提供的 composables
  2. // const seoSetup = function(title: string, description: string, keywords: string){
  3. // // 使用 useSeoMeta 设置 SEO 相关的 meta 标签
  4. // useSeoMeta({
  5. // title,
  6. // description,
  7. // keywords,
  8. // });
  9. // };
  10. // export {seoSetup};
  11. import { useHead } from '#imports'; // Nuxt 3 提供的 composables
  12. const seoSetup = (title: string, description: string, keywords: string) => {
  13. useHead({
  14. title: title,
  15. meta: [
  16. { name: 'description', content: description },
  17. { name: 'keywords', content: keywords }
  18. ]
  19. });
  20. };
  21. export {seoSetup};