nuxt2 SEO优化-汇率计算
在已经优化了对应不同语言以及页面添加title,meta,desc之上,网页的爬虫收录总数为19
本次优化汇率页面,最终实现收录总数278


实现方法针对汇率兑换的页面较为简单,依赖循环生成所有汇率对,在挂载前阶段进行html拼接,插入指定的dom即可,设置隐藏样式
let rateList = [
"USD-USDT",
"USD-USDB",
"USD-BTC",
"USD-ETH",
"USD-EOS",
"USD-BCH",
...
];
let staticHtml = "";
rateList.forEach((item) => {
const [from, to] = item.split("-");
staticHtml += `
<a
href="/rate-calculator/${item.replace("-", "/")}"
rel="canonical"
class="text-white-255 text-opacity-60 text-sm my-2 font-normal"
>
${from} ${this.$t("footer.footer_calculator_exchange")} ${to}
</a>
`;
});
// 现在staticHtml包含所有静态化的链接
this.staticHtml = staticHtml;
// 插入dom
<div class="h-0 hidden" v-html="staticHtml"></div>
愿以往所学皆有所获

浙公网安备 33010602011771号