Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: 为影片详情页面添加SEO优化 #59

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"@videojs-player/vue": "^1.0.0",
"@vueuse/head": "^2.0.0",
"axios": "^1.3.4",
"element-plus": "^2.8.6",
"video.js": "^8.0.4",
Expand Down
5 changes: 3 additions & 2 deletions client/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { router} from "./router/router";
// 引入elementPlus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 使用自定义loading
import {createHead} from '@vueuse/head'

// 使用自定义loading

const app = createApp(App)

Expand All @@ -15,7 +16,7 @@ app.use(ElementPlus)
// 引入路由
app.use(router)


app.use(createHead())

app.mount('#app')

Expand Down
14 changes: 13 additions & 1 deletion client/src/views/index/FilmDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import {ApiGet} from "../../utils/request";
import {ElMessage} from 'element-plus'
import {Promotion, CaretRight} from "@element-plus/icons-vue";
import RelateList from "../../components/index/RelateList.vue";
import {useSeoMeta} from "@vueuse/head";
// 获取路由对象
const router = useRouter()
const data = reactive({
Expand Down Expand Up @@ -202,6 +203,17 @@ onBeforeMount(() => {
message: resp.msg,
})
}
}).then(() => {
const titleName = `《${data.detail.name}》在线观看-迅雷下载-${data.detail.descriptor.classTag} `
const keywords = `${data.detail.name},${data.detail.descriptor.classTag},${data.detail.descriptor.area},${data.detail.descriptor.actor},${data.detail.descriptor.director}`
// 页面加载完成后,将当前影片信息存入store
//useTitleHelper(titleName)
useSeoMeta({
title: titleName,
description: data.detail.descriptor.blurb,
keywords: keywords
}
)
})

})
Expand Down Expand Up @@ -400,4 +412,4 @@ onBeforeMount(() => {
margin-right: 10px;
}

</style>
</style>