custom.js 670 B

1234567891011121314151617181920
  1. 'use strict';
  2. // 文章实效性提示
  3. hexo.extend.injector.register('body_end', `
  4. <script defer src="/theme-inject/timeliness.js"></script>
  5. `);
  6. // shynet 统计
  7. hexo.extend.injector.register('head_begin', `
  8. <script defer src="https://api.limour.top/vue/0d2f95c1-755d-436b-adf8-eee12a80ed32/script.js"></script>
  9. `);
  10. // 首选网页 canonical
  11. hexo.extend.helper.register('autoCanonical', function (config, page) {
  12. var base_url = config.url;
  13. if (config.url.charAt(config.url.length - 1) !== '/') base_url += '/';
  14. base_url += page.canonical_path
  15. return '<link rel="canonical" href="' + base_url.replace('/index.html', '/').replace(/\.html$/g, '') + '"/>';
  16. });