vue做seo优化(vue项目seo怎么做)

小程序开发 3178
本篇文章给大家谈谈vue做seo优化,以及vue项目seo怎么做对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。 本文目录一览: 1、Vue框架怎么做sitemap?

本篇文章给大家谈谈vue做seo优化,以及vue项目seo怎么做对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

Vue框架怎么做sitemap?

vue-router-sitemap

通过vue-router配置生成sitemap.xml

 // router.js

        import VueRouter from 'vue-router';

        export const router: VueRouter = new VueRouter(

            {

                routes: [

                    {

                        path: '/',

                        name: 'index',

                        component: Index,

                    },

                ],

            },

        );

 // sitemapMiddleware.js

        import VueRouterSitemap from 'vue-router-sitemap';

        import path from 'path';

        import { router } from 'router';

        export const sitemapMiddleware = () = {

            return (req, res) = {

                res.set('Content-Type', 'application/xml');

                const staticSitemap = path.resolve('dist/static', 'sitemap.xml');

                const filterConfig = {

                    isValid: false,

             芹液       rules: [

                        /\/example-page/,

                        /\*/,

                    ],

                };

                new 行亏VueRouterSitemap(router).filterPaths(filterConfig).build('').save(staticSitemap);

                return res.sendFile(staticSitemap);

      档首神      };

        };

        app.get('/sitemap.xml', sitemapMiddleware());

请采纳

做一个在线教育商城,考虑到seo,在技术栈上用vue,react,还是jQuery?

第一:支持的浏览器,一般vue和react要求较高IE8+,react16因为要使用requestAnimationFrame要IE9+,jquery不限

第二:考虑SEO,就要搭配路由做服务器端渲染。目前jquery支持jsp、php等服务器反馈的html上继续进行DOM操作。而vue和react则要在服务器端安装基于nodejs的SSR程序,把组件转换成HTML内容供搜索引擎爬取数据。

采用vue或react,就要在jsp或PHP前放一个nodejs的SSR程序,这样在肢启架构上就会多一层,SSR程序好茄负责处理路由和html渲染,而jsp和PHP只是提供一些调历袜如用数据库的API给上层SSR程序

采用jquery则可以保持原有的jsp或PHP去解析路由,渲染html

关于vue做seo优化和vue项目seo怎么做的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

扫码二维码