octopress / date-format

Automatically adds variables with nicely formated dates and time tags to Jekyll posts and pages.
MIT License
16 stars 13 forks source link

Can't Get Plugin to Function #6

Open tohuw opened 9 years ago

tohuw commented 9 years ago

Jekyll 2.5.3, Octopress 3.0.9, date-format 3.0.3

I've added the gem to my jekyll_plugins group in my Gemfile, and other plugins I've added there work fine. I can see the gem is installed, but upon building the site, neither the {{ post.date }} I've added to the post layout or the example conditional to show the post updated time display. I did add the date_updated setting in the YAML front matter of the post, but nothing ever renders after I build the site. What might I be doing wrong?

femmestem commented 5 years ago

jekyll 3.8.5, octopress 3.0.11, octopress-date-format 3.0.3

Same issue. The dates used to appear under my blog title, but it's not being rendered since updating to the latest release. I didn't make changes to the date.html partial that gets loaded into the post layout, yet it's no longer rendered.

{% if page.date %}{% capture time %}{{ page.date_html }}{% endcapture %}{% endif %}
{% if post.date %}{% capture time %}{{ post.date_html }}{% endcapture %}{% endif %}

{% if page.updated %}{% capture updated %}{{ page.date_updated_html }}{% endcapture %}{% endif %}
{% if post.updated %}{% capture updated %}{{ post.date_updated_html }}{% endcapture %}{% endif %}

I updated the following gems:

I added the gems to the plugins list where other Jekyll plugins are loading properly:

# config.yml
plugins_dir: ./plugins
plugins:
  - octopress-date-format
  - octopress-hooks
  ...
JetStarBlues commented 3 years ago

Did anyone manage to resolve this? When I upgraded the gem, it stopped working.

octopress-date-format 2.0.2 to 3.0.3

All the methods return null:

date_text
time_text
date_xml
date_html
date_time_html

Unfortunately, the previous version of the gem cannot be used with Jekyll 3. Bundler says:

octopress-date-format (~> 2.0) was resolved to 2.0.2, which depends on jekyll (~> 2.0)

Update: I've opted to remove the gem altogether and use something else. Thankfully it isn't used much in the code. Only date.html seems to use it.

davidxia commented 3 years ago

I think :page, :post here 1 should be changed to :pages, :posts. Jekyll docs here 2 (currently at version 4.2) have :pages and :posts. I didn't confirm that older Jekyll versions had the singular versions and made a breaking change to the plurals later on.

Changing to plurals made the plugin work for me (but with other discrepancies compared to older Jekyll and Octopress versions).

davidxia commented 3 years ago

Even after making the change in my above comment 1, this plugin still doesn't work for me. I'm using octopress 3.0.11 and jekyll 4.0.1. I came across this issue because I tried upgrading from octopress 2.x and jekyll 2.5.3. This previous combination of octopress and jekyll worked because jekyll 2.5.3 has code to extract the date from the post's filename here 2 and assign it to a page and post's date attribute before execution hits octopress-date-format here 3.

Jekyll 4.0.1 doesn't seem to set the date attribute on pages and posts anymore by parsing the file name. The closest logic to that I can see if this 4, but execution doesn't seem to hit this line before 3.

I tried the 3 workarounds below