使用vue开发前端后如何再使用php做静态网页seo

大家都知道vue开发后seo十分难做,基本一个月甚至几个月都没办法收录网站,这是我观察易易二维码(https://eema.cn),网站发现的一个方法。
本次开发使用tp8框架和uniapp开发。

1.首页我们都知道vue开发uniapp开发都有一共入口文件,默认为index.html,通过入口文件进行加载路由等文件。
这个是默认的入口文件,此时是没办法做任何seo的,因为百度没办法读取里面的路由数据。

<!DOCTYPE html>
<html lang="zh">
	<head>
		<title>文件二维码生成器 - 文件在线生成二维码免费不限容量不限流量 - 文件在线预览 - 文件二维码制作不限数量 | 文件码</title>
		<meta charset="UTF-8" name="keywords" content="文件生成二维码,文件二维码,二维码生成器,文件在线预览,文件码,免费二维码,二维码制作" />
		<link rel="icon" type="image/png" href="/static/ico/logo.png" alt="文件码网站Logo">
		<meta name="description"
			content="文件码是一款可免费商用的文件二维码生成器,为您提供文件在线预览、文件转二维码等服务用于文件分享,支持 word、Excel、Pdf、PPT 等多种常见格式文件在线转码和在线浏览!免费不限账户容量,不限文件流量!">
		<link rel="icon" href="/static/ico/favicon.ico">
		<script>
			var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
				CSS.supports('top: constant(a)'))
			document.write(
				'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
				(coverSupport ? ', viewport-fit=cover' : '') + '" />')
		</script>

	</head>
	<body>
		<div id="app"><!--app-html--></div>
		<script type="module" src="/main.js"></script>
	</body>
	<style>
		html,
		body {
			margin: 0;
			padding: 0;
			width: 100%;
		}
	</style>
</html>

2.这里是我使用tp框架把入口文件放入view进行模板渲染,再引入vue的路由的基础上,我们在body下面再使用tp的模板渲染,这样既可以使用vue的简单方法,也可以做静态网站的seo,使用这个方法提交收录后,几天就收录了官网。如果还是之前的纯vue的话基本收录无望。因为百度收录是按照你的文章质量、网站的质量等。纯vue百度无法读取vue里面的接口,vue都是动态渲染的。

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>易易二维码 - 免费好用的文件二维码生成器</title>
    <meta name="keywords" content="文件生成二维码,文件二维码,二维码生成器,文件在线预览,文件码,免费二维码,二维码制作"/>
    <meta name="description"
          content="易易二维码是一款可免费商用的文件二维码生成器,为您提供文件在线预览、文件生成二维码等服务用于文件分享,支持 word(doc、dot、wps、docx)、Excel(xls、xlt、csv、xlsx)、Pdf、PPT 等多种常见格式文件在线转码和在线浏览!免费且不限账户容量,不限文件流量!">
    <link rel="icon" href="/assets/favicon-3efb78e6.ico">
    <link rel="stylesheet" href="/assets/uni.17e682f8.css">
    <link rel="icon" type="image/png" href="/assets/logo-b8e95bd0.png" alt="易易二维码网站Logo">
    <script>
        var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
            CSS.supports('top: constant(a)'))
        document.write(
            '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
            (coverSupport ? ', viewport-fit=cover' : '') + '" />')
    </script>

    <script type="module" crossorigin src="/assets/index-56098b2a.js"></script>
    <link rel="stylesheet" href="/assets/index-20439fd3.css">
</head>
<body>
<div id="app"><!--app-html--></div>
<div style="height: 50px;overflow: hidden;display: flex;position: fixed;top: 0px">
    <h1 >文件二维码生成器</h1>
    <div class="jiaocheng" >
        <div class="container">
            <div style="display: flex">
                {foreach $data as $key=>$vo }
                <div class="jc_liebiao" style="height: 200px">
                    <div class="jc_wenzhang">
                        <div class="jc_biaoti">
                            <a href="/index.php/neirong/{$vo.key}" title="{$vo.title}">
                                <span title="{$vo.title}">{$vo.title}</span>
                            </a>
                            <span>发布时间:{$vo.update_time}</span>
                        </div>
                        <div class="jc_jianjie text-over-twolineBody" style="width: 200px">
                            {$vo.description|raw}
                        </div>
                    </div>
                    <div class="jc_fenlei">
                        <div class="jc_fenleibiaoti">
                            <a href="/index.php/neirong/{$vo.key}" title="{$vo.sub_title}">
                                <span class="text-over-twolineBody" style="width: 200px">{$vo.sub_title}</span>
                            </a>
                        </div>
                    </div>
                </div>
                {/foreach}
            </div>
            <div style="width: 100%;">
                <div style="width: 100%;display:flex;justify-content: center;margin-top: 20px">
                    <div style="width: 80%;border-radius: 2px;display: flex;justify-content: space-between;background: white">
                        <div style="width: 40%;padding: 10px">
                            <img style="width: 250px;height: 50px;"
                                 src="">
                            <div style="font-size: 12px;margin-top: 8px">
                                我们努力把文件码功能做得更加简单
                            </div>
                            <div style="font-size: 12px;margin-top: 5px">
                                让每个人和组织都可以轻松使用
                            </div>
                            <div style="display: flex;margin-top: 30px">
                                <div style="width: 80px">
                                    <img style="width: 80px;height: 80px;" alt="微信小程序"
                                         src="">
                                    <div style="font-size: 12px;display: flex;justify-content: center">微信小程序</div>
                                </div>
                                <div style="width: 80px;margin-left: 10px">
                                    <img style="width: 80px;height: 80px;" alt="微信公众号"
                                         src="">
                                    <div style="font-size: 12px;display: flex;justify-content: center">微信公众号</div>
                                </div>
                            </div>
                        </div>
                        <div style="width: 60%;padding: 10px">
                            <div style="font-size: 12px;font-weight: bold;display: flex;align-items: center">友情链接</div>
                            <div style="border-bottom: 1px solid #c8c9cc;width: 100%;margin-top: 5px;margin-bottom: 20px"></div>
                            <div style="display: flex">
                                {foreach $friendshipOnt as $key=>$vo }
                                {eq name="$vo.go_status" value="2"}
                                <a href="{$vo.url}" style="padding: 5px" title="{$vo.title}">
                                    <div style="margin-right: 10px;;display: flex;align-items: center">
                                        <span style="color: black;font-size: 12px">{$vo.title}</span>
                                    </div>
                                </a>
                                {else/}
                                <a href="{$vo.url}" style="padding: 5px" title="{$vo.title}" rel="nofollow">
                                    <div style="margin-right: 10px;;display: flex;align-items: center">
                                        <span style="color: black;font-size: 12px">{$vo.title}</span>
                                    </div>
                                </a>
                                {/eq}
                                {/foreach}
                            </div>
                            <div style="display: flex">
                                {foreach $friendshipTwo as $key=>$vo }
                                {eq name="$vo.go_status" value="2"}
                                <a href="{$vo.url}" style="padding: 5px" title="{$vo.title}">
                                    <div style="margin-right: 10px;;display: flex;align-items: center">
                                        <span style="color: black;font-size: 12px">{$vo.title}</span>
                                    </div>
                                </a>
                                {else/}
                                <a href="{$vo.url}" style="padding: 5px" title="{$vo.title}" rel="nofollow">
                                    <div style="margin-right: 10px;;display: flex;align-items: center">
                                        <span style="color: black;font-size: 12px">{$vo.title}</span>
                                    </div>
                                </a>
                                {/eq}

                                {/foreach}
                            </div>
                        </div>
                    </div>
                </div>
                <div style="width: 100%;display:flex;align-items: center;justify-content: center;margin-top: 50px;padding-bottom: 50px">
                    <div style="width: 80%;display: flex;justify-content: center">
                        <div style="display: flex">
                            {foreach $config.tool_icp_config as $key=>$vo }
                            <div style="display: flex;align-items: center;margin-right: 15px">
                                <div style="margin-left: 10px;font-size: 12px;color: #909399">
                                    <a href="{$vo.path}" rel="nofollow">
                                        {$vo.title}
                                    </a>
                                </div>
                            </div>
                            {/foreach}
                            <a href="" title="文件码sitemap">
                                <div style="display: flex;align-items: center;margin-right: 15px">
                                    <div style="margin-left: 10px;font-size: 12px;color: #909399">
                                        文件码Sitemap
                                    </div>
                                </div>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div style="background-color: white;position: absolute;top: 0px;width: 100%;height: 50px"></div>
</div>
</body>
<style>
    .text-over-twolineBody {
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    html,
    body {
        margin: 0;
        padding: 0;
        width: 100%;
    }
</style>
</html>

这样就可以兼容vue的开发便利,又可以进行vue的seo模板静态渲染。两全其美,唯一不足就需要vue和服务器端放在同一个服务器。无法做到前后端分离。

  • 8
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值