-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date error when running latest middleman-blog against middleman 4 alpha 6 #238
Comments
👍 would love to use middleman 4 :-D |
Thanks @dwcramer We're going to prioritize getting the core to beta this month, then will make sure all the core extensions are ready the following month. |
Thanks @tdreyno, looking forward to using some of the new middleman 4 stuff! |
This is still a problem in middleman (4.0.0.beta.2) and middleman-blog (3.6.0.beta.2) |
just run into this problem myself. Something strange is happening with the HashWithIndiferentAccess holding the article |
If this helps finding a solution I found out BlogData is not working properly at the moment the date is retrieved, so I decided to manually parse the template file like this:
That is a quite dirty hack, but it gets the blog working again. The interesting thing is that later, rendering the template pulls out fine the other front matter variables |
@fgarcia Can you describe the current issue more fully? Where does this occur? What errors are shown? |
Sure! On v4 this error is raised because the date from While debugging I noticed that at this point It seems this error only appears with configurations where the date is not encoded in the filename itself. Therefore the default configuration hides this glitch because the code afterwards parses the filename date. As en example, this is my blog configuration:
As I mentioned before, parsing manually the article yaml date makes everything work perfectly, even the tags are shown! I am not sure if it is related, but I also had some problems with relative assets Hope that helps solving the issue! |
Thanks for the thorough description, @fgarcia. Did this work on v3? |
I've just tested in a fresh new project articles without a date in their filename and yes, it works on v3 |
As of https://github.com/middleman/middleman/pull/1293/files middleman splits the notion of `:mode` and `:config`. This PR updates middleman-blog to also handle this distinction. This allows generation of blogposts using config for a particular environment using the `--environment` flag. e.g: `middleman article 'Awesome new post' --environment blog would look for config within the `configure :blog do ...` block. The main gotcha I see is that this requires `Time.zone` to be set in config.rb also. I wonder though if that is related to one of the various other date-related issues: middleman#238, middleman#191, middleman#143
Still an issue for me. did this get resolved? |
Oh, i retried by using the cli to create the file, not just doing manually and now works. |
This ticket is very old. If you're still having issues on the current release, please open a new ticket. |
There is date in frontmatter as: date: 2009-03-01
|
I came across this issue right now. For me it seems to have been caused by Psych 4.x, which does no longer support deserializing classes like Note that this only happens if the date or time values in the YAML frontmatter are unquoted (and thus not loaded as strings, but interpreted as instances of date: 2022-02-22 # won't work
date: "2022-02-22" # works TL;DR: The fix is to make sure the dates / times in the YAML frontmatter are quoted. More details To verify that this is indeed the problem run bundle exec ruby -e "require 'yaml'; YAML.load_file('source/articles/example.md')" and see if it gives an error like If for any reason you want to keep the bare date / time values in the frontmatter, a possible workaround is to explicitly specify an older version of Psych in the gem "psych", "< 4" |
Upgrading was required because bundling wasn't working locally + Ruby v2.7.3 is kinda old 👀 With the upgrade to latest ruby version came a few issues. First, it required to add `net-ftp` to Gemfile, as it was blocking launch of middleman. I tried but could not really identify why this was needed, if somebody feels like exploring it and giving feedback, I'd gladly hear it 😄 Second, with latest middleman came an issue with date, it was kinda ignored until we use quotes around them (aka. make them strings that need to be later on translated into dates), as stated in this issue resolving comment [on middleman-blog issue #238](middleman/middleman-blog#238 (comment))
Upgrading was required because bundling wasn't working locally + Ruby v2.7.3 is kinda old 👀 With the upgrade to latest ruby version came a few issues. First, it required to add `net-ftp` to Gemfile, as it was blocking launch of middleman. I tried but could not really identify why this was needed, if somebody feels like exploring it and giving feedback, I'd gladly hear it 😄 Second, with latest middleman came an issue with date, it was kinda ignored until we use quotes around them (aka. make them strings that need to be later on translated into dates), as stated in this issue resolving comment [on middleman-blog issue #238](middleman/middleman-blog#238 (comment))
Upgrading was required because bundling wasn't working locally + Ruby v2.7.3 is kinda old 👀 With the upgrade to latest ruby version came a few issues. First, it required to add `net-ftp` to Gemfile, as it was blocking launch of middleman. I tried but could not really identify why this was needed, if somebody feels like exploring it and giving feedback, I'd gladly hear it 😄 Second, with latest middleman came an issue with date, it was kinda ignored until we use quotes around them (aka. make them strings that need to be later on translated into dates), as stated in this issue resolving comment [on middleman-blog issue #238](middleman/middleman-blog#238 (comment))
I'm seeing the error below when I use middleman-blog (from github) with middleman 4 alpha 6 running ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]. A small site that illustrates the bug is here https://github.com/dwcramer/middleman-4-blog-bug
The text was updated successfully, but these errors were encountered: