hookehuyr

配置SEO设置

<!--
* @Date: 2024-09-26 13:36:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-04 11:24:30
* @FilePath: /hager/index.html
* @Description: 文件描述
-->
<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8" />
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
<link rel="shortcut icon" href="/favicon-fr-32.png" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>海格电气官方网站</title>
<meta name="keywords" content="海格集团是全球领先的电气及智能化解决方案和服务提供商,应用领域涵盖住宅、商业建筑、公共建筑和工业。海格电气品牌代表了集团的核心业务,覆盖配电系统、电缆管理系统,KNX 智能控制系统和开关面板、楼宇自动化和安防系统。">
<meta name="description" content="构建未来电气世界 让人们的生活更安全、更清洁、更愉悦">
</head>
<body>
<div id="app"></div>
......
......@@ -27,9 +27,12 @@
"mui-player": "^1.8.1",
"object-fit-images": "^3.2.4",
"sass": "1.55.0",
"sitemap": "^8.0.0",
"swiper": "5",
"vite-plugin-sitemap": "^0.7.1",
"vue": "2.7.13",
"vue-awesome-swiper": "4.1.1",
"vue-meta": "^2.4.0",
"vue-router": "3.6.5"
},
"devDependencies": {
......
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
\ No newline at end of file
<!--
* @Date: 2024-09-26 13:36:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-01 18:35:42
* @LastEditTime: 2024-11-04 13:11:08
* @FilePath: /hager/src/App.vue
* @Description: 文件描述
-->
......@@ -21,6 +21,14 @@ import hagerFooter from '@/components/common/hagerFooter.vue';
import mixin from '@/common/mixin';
export default {
// TAG:配置页面meta和标题信息
metaInfo: {
title: '海格电气官方网站',
meta: [
{ name: 'keyword', content: '海格集团是全球领先的电气及智能化解决方案和服务提供商,应用领域涵盖住宅、商业建筑、公共建筑和工业。海格电气品牌代表了集团的核心业务,覆盖配电系统、电缆管理系统,KNX 智能控制系统和开关面板、楼宇自动化和安防系统。' },
{ name: 'description', content: '构建未来电气世界 让人们的生活更安全、更清洁、更愉悦' },
]
},
components: { hagerHeader, hagerFooter },
mixins: [mixin.init],
data () {
......
/*
* @Date: 2024-08-26 10:12:56
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-10-16 15:23:50
* @LastEditTime: 2024-11-04 13:06:56
* @FilePath: /hager/src/main.js
* @Description: 文件描述
*/
......@@ -22,6 +22,8 @@ import VueAwesomeSwiper from 'vue-awesome-swiper';
// import 'swiper/swiper-bundle.css'; // 确保引入正确的CSS文件路径
import 'swiper/css/swiper.css'; // 确保引入正确的CSS文件路径
import VueMeta from 'vue-meta';
Vue.use(VueRouter);
// Vue.use(ElementUI);
// Vue.use(Button).use(Row).use(Col)
......@@ -70,6 +72,12 @@ function clampText(element, lineCount) {
}
}
Vue.use(VueMeta, {
// 配置项
keyName: 'metaInfo', // 组件中用来定义元信息的属性名
refreshOnceOnNavigation: true
});
new Vue({
router,
render: (h) => h(App),
......
/*
* @Date: 2024-08-26 10:42:15
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-04 09:33:28
* @LastEditTime: 2024-11-04 12:50:25
* @FilePath: /hager/src/route.js
* @Description: 文件描述
*/
......
/*
* @Date: 2024-08-26 10:12:56
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-10-25 20:54:17
* @LastEditTime: 2024-11-04 12:49:23
* @FilePath: /hager/vite.config.js
* @Description: 文件描述
*/
......@@ -14,11 +14,33 @@ import { createProxy } from './build/proxy';
import Components from 'unplugin-vue-components/vite';
import { ElementUiResolver } from 'unplugin-vue-components/resolvers';
import commonjs from 'vite-plugin-commonjs';
import sitemap from 'vite-plugin-sitemap'; // 生成网站的站点地图,以便搜索引擎可以更容易地抓取网站上的页面
// var path = require('path');
import path from 'path-browserify';
// const fs = require('fs');
const names = [
'/',
'product/index',
'product/detail',
'solution/index',
'solution/detail',
'solution/case',
'about',
'about/global',
'about/china',
'about/design',
'about/product',
'about/development',
'about/honors',
'concat',
'news',
'news/detail',
'recruit',
]
const dynamicRoutes = names.map(name => `/f/hager/#/${name}`)
// https://vitejs.dev/config/
export default ({ command, mode }) => {
const root = process.cwd();
......@@ -58,6 +80,26 @@ return defineConfig({
resolvers: [ElementUiResolver()],
}),
commonjs(), // 将 CommonJS 模块转换为 ES Modules
sitemap({
hostname: 'http://www.hager-electric.com/', // 设置网站根 URL
outDir: 'hager',
exclude: ['**/user'],
lastmod: true,
changefreq: 'daily',
priority: 0.7,
ignore: ['**/*.json', '**/*.md'],
dynamicRoutes,
routes: [
'/',
'/product/index',
'/product/detail',
'/solution/index',
'/solution/detail',
'/solution/case',
'/about',
],
generateRobotsTxt: false // 禁用 robots.txt 生成
})
],
publicDir: 'public', // 作为静态资源服务的文件夹。这个目录中的文件会在开发中被服务于 /,在开发模式时,会被拷贝到 outDir 的根目录,并没有转换,永远只是复制到这里。该值可以是文件系统的绝对路径,也可以是相对于项目的根目录路径。
// cacheDir: '', // 存储缓存文件的目录。此目录下会存储预打包的依赖项或 vite 生成的某些缓存文件,使用缓存可以提高性能。如需重新生成缓存文件,你可以使用 --force 命令行选项或手动删除目录。此选项的值可以是文件的绝对路径,也可以是以项目根目录为基准的相对路径。
......
......@@ -1252,6 +1252,25 @@
resolved "https://mirrors.cloud.tencent.com/npm/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50"
integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==
"@types/node@*":
version "22.8.7"
resolved "https://mirrors.cloud.tencent.com/npm/@types/node/-/node-22.8.7.tgz#04ab7a073d95b4a6ee899f235d43f3c320a976f4"
integrity sha512-LidcG+2UeYIWcMuMUpBKOnryBWG/rnmOHQR5apjn8myTQcx3rinFRn7DcIFhMnS0PPFSC6OafdIKEad0lj6U0Q==
dependencies:
undici-types "~6.19.8"
"@types/node@^17.0.5":
version "17.0.45"
resolved "https://mirrors.cloud.tencent.com/npm/@types/node/-/node-17.0.45.tgz#2c0fafd78705e7a18b7906b5201a522719dc5190"
integrity sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==
"@types/sax@^1.2.1":
version "1.2.7"
resolved "https://mirrors.cloud.tencent.com/npm/@types/sax/-/sax-1.2.7.tgz#ba5fe7df9aa9c89b6dff7688a19023dd2963091d"
integrity sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==
dependencies:
"@types/node" "*"
"@vitejs/plugin-legacy@^5.4.2":
version "5.4.2"
resolved "https://mirrors.cloud.tencent.com/npm/@vitejs/plugin-legacy/-/plugin-legacy-5.4.2.tgz#2eaefcbdf6f975f95ad482dc73e8177e14cd2a5a"
......@@ -1305,6 +1324,11 @@ anymatch@~3.1.2:
normalize-path "^3.0.0"
picomatch "^2.0.4"
arg@^5.0.0:
version "5.0.2"
resolved "https://mirrors.cloud.tencent.com/npm/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c"
integrity sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==
async-validator@~1.8.1:
version "1.8.5"
resolved "https://mirrors.cloud.tencent.com/npm/async-validator/-/async-validator-1.8.5.tgz#dc3e08ec1fd0dddb67e60842f02c0cd1cec6d7f0"
......@@ -1538,6 +1562,11 @@ deepmerge@^1.2.0:
resolved "https://mirrors.cloud.tencent.com/npm/deepmerge/-/deepmerge-1.5.2.tgz#10499d868844cdad4fee0842df8c7f6f0c95a753"
integrity sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==
deepmerge@^4.2.2:
version "4.3.1"
resolved "https://mirrors.cloud.tencent.com/npm/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a"
integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==
define-data-property@^1.1.4:
version "1.1.4"
resolved "https://mirrors.cloud.tencent.com/npm/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e"
......@@ -2335,6 +2364,16 @@ side-channel@^1.0.6:
get-intrinsic "^1.2.4"
object-inspect "^1.13.1"
sitemap@^8.0.0:
version "8.0.0"
resolved "https://mirrors.cloud.tencent.com/npm/sitemap/-/sitemap-8.0.0.tgz#eb6ea48f95787cd680b83683c555d6f6b5a903fd"
integrity sha512-+AbdxhM9kJsHtruUF39bwS/B0Fytw6Fr1o4ZAIAEqA6cke2xcoO2GleBw9Zw7nRzILVEgz7zBM5GiTJjie1G9A==
dependencies:
"@types/node" "^17.0.5"
"@types/sax" "^1.2.1"
arg "^5.0.0"
sax "^1.2.4"
"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.2.0:
version "1.2.0"
resolved "https://mirrors.cloud.tencent.com/npm/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af"
......@@ -2414,6 +2453,11 @@ ufo@^1.5.3:
resolved "https://mirrors.cloud.tencent.com/npm/ufo/-/ufo-1.5.4.tgz#16d6949674ca0c9e0fbbae1fa20a71d7b1ded754"
integrity sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==
undici-types@~6.19.8:
version "6.19.8"
resolved "https://mirrors.cloud.tencent.com/npm/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==
unicode-canonical-property-names-ecmascript@^2.0.0:
version "2.0.0"
resolved "https://mirrors.cloud.tencent.com/npm/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc"
......@@ -2498,6 +2542,11 @@ vite-plugin-dynamic-import@^1.6.0:
fast-glob "^3.3.2"
magic-string "^0.30.11"
vite-plugin-sitemap@^0.7.1:
version "0.7.1"
resolved "https://mirrors.cloud.tencent.com/npm/vite-plugin-sitemap/-/vite-plugin-sitemap-0.7.1.tgz#3b3cf6d2e067ec835f810e5eaaacf05485c819fe"
integrity sha512-4NRTkiWytLuAmcikckrLcLl9iYA20+5v6l8XshcOrzxH1WR8H0O3S6sTQYfjMrE8su/LG6Y0cTodvOdcOIxaLw==
vite@^5.4.1:
version "5.4.2"
resolved "https://mirrors.cloud.tencent.com/npm/vite/-/vite-5.4.2.tgz#8acb6ec4bfab823cdfc1cb2d6c53ed311bc4e47e"
......@@ -2514,6 +2563,13 @@ vue-awesome-swiper@4.1.1:
resolved "https://mirrors.cloud.tencent.com/npm/vue-awesome-swiper/-/vue-awesome-swiper-4.1.1.tgz#8f7ab221ad003021d756b86aa618f429924900fe"
integrity sha512-50um10t6N+lJaORkpwSi1wWuMmBI1sgFc9Znsi5oUykw2cO5DzLaBHcO2JNX21R+Ue4TGoIJDhhxjBHtkFrTEQ==
vue-meta@^2.4.0:
version "2.4.0"
resolved "https://mirrors.cloud.tencent.com/npm/vue-meta/-/vue-meta-2.4.0.tgz#a419fb4b4135ce965dab32ec641d1989c2ee4845"
integrity sha512-XEeZUmlVeODclAjCNpWDnjgw+t3WA6gdzs6ENoIAgwO1J1d5p1tezDhtteLUFwcaQaTtayRrsx7GL6oXp/m2Jw==
dependencies:
deepmerge "^4.2.2"
vue-router@3.6.5:
version "3.6.5"
resolved "https://mirrors.cloud.tencent.com/npm/vue-router/-/vue-router-3.6.5.tgz#95847d52b9a7e3f1361cb605c8e6441f202afad8"
......