【问题标题】:Meteor.js public folder not serving .html fileMeteor.js 公用文件夹不提供 .html 文件
【发布时间】:2013-12-28 22:20:07
【问题描述】:

我有一个来自 Google 的 .html 文件,需要在 http://www.domain.com/google1234567890123456.html 提供服务。我将 .html 文件放入 pathToMeteorApp/public/,但是当我访问该 URL 时,Meteor 为我提供了一个带有一些模板的空白页面。

我正在使用iron-router,那么即使 .html 文件位于公用文件夹中,路由器是否仍在管理 .html 文件的 url?如果是这样,我们如何防止这种情况并直接在该 url 提供 .html 文件?

router.js

【问题讨论】:

  • 这是可能的。你能分享你定义的铁路由路由吗?
  • @ChristianF 当然,更新了路线的帖子

标签: javascript node.js meteor meteorite iron-router


【解决方案1】:

我会尝试创建一条路线:

Router.map(function() {
   this.route('google', {
       path: '/google1234567890123456.html'
   });
});

和模板:

<template name="google">
    <!-- Your google1234567890123456.html content in <body></body> here -->
</template>

如果它包含任何脚本,您可以在渲染函数中执行它们:

//client code
Template.google.rendered = function() {
    //execute google scripts
}

【讨论】:

    猜你喜欢
    • 2017-02-10
    • 2016-11-06
    • 1970-01-01
    • 2016-08-22
    • 2015-04-27
    • 2020-06-28
    • 1970-01-01
    • 1970-01-01
    • 2019-05-26
    相关资源
    最近更新 更多