7.4. 需要用户登录
除了上述两种限制访问内容的方式外,还有另一种有用的技术:需要一个登录用户。
使用 Liquid 标签非常容易实现。您要做的只是将仅可供登录用户使用的内容嵌套在以下条件中:
{{ if current_user }}
// only visible if the user is logged in
{{ endif }}
{{ if current_user }}
// only visible if the user is logged in
{{ endif }}