We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
这一篇放了最久,因为这是一个很老的话题了,大约在我刚刚接触 Angular 的时候,需要处理 Angular 项目的 SEO 问题,实践了一个解决方案,也在实践过程中遇到了很多问题,丰富了这个解决方案。
当时是 Angular 的时代,还没有流行起来使用 React 和 Vue,也就没有现在的 Server-Render 和 isonomorphic(同构)的解决方案。所以当时的解决方案放在现在的单页面应用上能够有用,但是已经不再推荐了。
用一张图来表示的话:
基于以上的过程,确定基本使用以下技术来实现:
后面几个问题基本是设置上的问题。
后来,运行的过程中当然也出现了一些问题:
function FileSystem(options) { this.options = options; mkdirp.sync(this.options.snapshotFolder); } /** * 从路径中获取 html snapshot */ FileSystem.prototype.get = function (hashedPath, callback) { var filePath = this.options.snapshotFolder + '/' + hashedPath.substring(0, 10).split('').join('/') + '/' + hashedPath; fs.readFile(filePath, 'utf8', function (err, data) { if (err) { callback(err); } else { callback(err, data); } }); }; /** * 向路径中存储 html snapshot */ FileSystem.prototype.set = function (hashedPath, snapshot, callback) { var that = this; mkdirp(that.options.snapshotFolder + '/' + hashedPath.substring(0, 10).split('').join('/'), function () { var filePath = that.options.snapshotFolder + '/' + hashedPath.substring(0, 10).split('').join('/') + '/' + hashedPath; fs.writeFile(filePath, snapshot, function (err, data) { callback(err, data); }); }); }; /** * 从路径中删除 html snapshot */ FileSystem.prototype.del = function (hashedPath, callback) { var filePath = this.options.snapshotFolder + '/' + hashedPath.substring(0, 10).split('').join('/') + '/' + hashedPath; fs.unlink(filePath, callback); }; module.exports = function (options) { return new FileSystem(options); };
好啦,这个小小的总结完成了一个心愿。
The text was updated successfully, but these errors were encountered:
sweeetcc
No branches or pull requests
SPA 的 SEO 解决方案
这一篇放了最久,因为这是一个很老的话题了,大约在我刚刚接触 Angular 的时候,需要处理 Angular 项目的 SEO 问题,实践了一个解决方案,也在实践过程中遇到了很多问题,丰富了这个解决方案。
背景:
当时是 Angular 的时代,还没有流行起来使用 React 和 Vue,也就没有现在的 Server-Render 和 isonomorphic(同构)的解决方案。所以当时的解决方案放在现在的单页面应用上能够有用,但是已经不再推荐了。
方案:
用一张图来表示的话:
技术:
基于以上的过程,确定基本使用以下技术来实现:
遇到的问题:
后面几个问题基本是设置上的问题。
后来,运行的过程中当然也出现了一些问题:
好啦,这个小小的总结完成了一个心愿。
The text was updated successfully, but these errors were encountered: