Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

能不能对 .html 不处理 #158

Closed
guoshuang opened this issue Apr 19, 2013 · 9 comments
Closed

能不能对 .html 不处理 #158

guoshuang opened this issue Apr 19, 2013 · 9 comments
Labels
bug Something isn't working

Comments

@guoshuang
Copy link

#148 一样的问题

前几天的版本 对 source 中的 .htm .html 不处理,可以写一些自己的页面
今天升级以后就不行了 —.htm .html 文件都会被当成 .md 处理

我觉得只处理 .md 文件就好,其它 copy 到 public 就行了。

@youxiachai
Copy link

这个需要在主题模板中里面处理.
例如,如果启用layout.ejs的话,可以用yaml 标注页面layout: fasle,然后在layout.ejs 里面加一个判断
<% if(page.layout === false)%> 之类的 ... #143 这里也有说明,当然,如果页面很多的话,那样的可以考虑建一个分类,然后,在主题渲染的入口文件,判断该分类不进行渲染 ,主题制作这里又一篇..http://blog.gfdsa.net/2013/04/09/hexolessontwo/

@guoshuang
Copy link
Author

to youxiachai ,谢谢回复
根据你的建议,我试验建立 test.htm 内容

layout: false
--------
11111111

然后修改 themes 里的 layout.ejs 加入你说的判断,然后 hexo genarate,可是 public 中生成的 test.html 还是被 render 了(htm->html 并且加入了头尾模板)

另外,“主题渲染的入口文件” 具体怎么做呢?我在 /usr/local/lib/node_modules/hexo/lib/ 目录仔细查看了一下几个文件。鉴于水平问题,没找出问题所在(虽然我看到了 get ext 之类的字眼,但还是没弄清楚,它们之间的调用关系)

请大家赐教。

@youxiachai
Copy link

https://gist.github.com/youxiachai/5424370

要不参考一下吧 而且,yaml 语法是最后三横线吧...

@Elstein
Copy link

Elstein commented Apr 21, 2013

谢谢 youxiachai,你说的办法的确可行。我改了个办法 http://guoshuang.com/2013/04/21/hexo-static-file/
好处就是不用一一改那些 .htm
但是,.htm 还是会被 render 为 .html,tommy351 应该给个参数:是否渲染静态 htm 文件等,类似下面

render: ["md","markdown"]

谢谢

@bytes-crafter
Copy link

上面一次提交修复的问题,好像对在 source 目录里手动创建的 html 没作用

@JuanitoFatas
Copy link
Contributor

hexo 1.1.3 測試過在 html 最上方加入

layout: false
---

是沒問題的。

@flyinhigh
Copy link

能不能加个选择,针对README.md是不编译的,不然push到git上就成了README.html。。。

@asdf2014
Copy link

asdf2014 commented Apr 8, 2017

是呀,根目录下 想放一些 自己写的 html/md 文件,各种乱编译了,,skip_render是针对 source_dir的,更目录 就不好弄了~~~

@asdf2014
Copy link

asdf2014 commented Apr 8, 2017

貌似 skip_render不支持 直接写 *.html可以不用正则表达式,直接写完全的文件名就可以了:)

skip_render:
 - google1a26b0b2267d26d7.html

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants