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 }}