How do you set html / body tag attributes in Meteor.js?

后端 未结 2 631
温柔的废话
温柔的废话 2021-02-19 07:34

I need to set attributes on the html tag or alternatively the body tag of the document in a Meteor.js application.

Specifically I want to have

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-19 08:13

    Attributes for HTML tag can be set on startup by using WebApp.addHtmlAttributeHook function. Here is an example:

    Meteor.startup(function() {
        WebApp.addHtmlAttributeHook(function() {
            return {
                "dir": "rtl"
            }
        })
    });
    

    Make sure you call this on server, not client.

提交回复
热议问题