我正在使用Liquid和Jekyll在我的乐队网站上发布日期(http://longislandsound.com.au)
我想要的是自动隐藏旧日期,所以我不必再进去删除它们.我认为最好的方法是将发布日期与当前日期进行比较,如果日期是将来只显示帖子,但我无法弄清楚如何做到这一点.
这是当前的代码:
<ul id="dates">
{% for post in site.posts reversed %}
<a href="{{post.link}}">
<li>
<div class="date">
<span class="day">{{post.date | date: "%d"}}</span><br />
<span class="month">{{post.date | date: "%b"}}</span>
<span class="week">{{post.date | date: "%a"}}</span>
</div>
<div class="details">
<span class="venue">{{post.venue}}</span><br />
<span class="town">{{post.town}}</span>
</div>
</li>
</a>
{% endfor %}
</ul>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了一些if语句,但我无法弄清楚如何将发布日期与当前日期进行比较.
有人可以帮忙吗?
我在我使用Figaro gem设置的外部文件(config/application.yml)中设置了我的Sendgrid密码.这在我的本地计算机上工作正常,但在我的服务器上,我收到一个错误,没有设置密码:
ArgumentError (SMTP-AUTH requested but missing secret phrase)
Run Code Online (Sandbox Code Playgroud)
当我将Sendgrid配置更改为纯文本密码时,它工作正常,所以我假设Rails没有识别环境变量.奇怪的是,当我进入rails console production并执行puts ENV["SENDGRID_PASSWORD"]它工作正常.
有任何想法吗?
这是我的Sendgrid配置:
config.action_mailer.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 587,
:user_name => "chrislawrence",
:password => ENV['SENDGRID_PASSWORD'],
:domain => "lakecinema.net.au",
:authentication => :plain,
:enable_starttls_auto => true
}
Run Code Online (Sandbox Code Playgroud)