Comments (19)
Are you using the master
version of middleman-blog/middleman? I've removed :blog_layout_engine
in recent versions, and I wouldn't expect the old versions to work very well in general.
from middleman-blog.
Well, I've installed middleman blog through rubygems, so I thought it's the master version. So, I can't use slim as template language?
from middleman-blog.
You certainly should be able to. I'm just saying if you use the tip version (put this in your Gemfile):
gem 'middleman-blog', :git => 'http://github.com/middleman/middleman-blog'
gem 'middleman', :git => 'http://github.com/middleman/middleman'
Then it should work without you having to specify any :blog_layout_engine
setting. Just having layout.slim
should work. If it doesn't, I'd like to know about it.
from middleman-blog.
Let's back up :)
He's running on the release 2.x series from Rubygems, so let's troubleshoot that.
@lucassmagal Are you using a Gemfile? If so, is "slim" listed? If not, I'll assume you've already got the slim gem on your system. Can you try adding:
require "slim"
at the top of your config.rb
from middleman-blog.
@tdreyno , I already tried to do this, and nothing works, yet =S
@bhollis , I don't have a Gemfile, so I'm creating one. I created a new dir called "blog" and put it inside a Gemfile containing these lines, plus "gem 'slim'". Is that alright?
from middleman-blog.
What errors are you getting?
from middleman-blog.
I think I fixed the error you were seeing.
from middleman-blog.
I'm getting a similar issue when trying to run middleman-blog with my slim template. I have a log/:category/:title.html
structure.
Here is my config.rb file:
require 'slim'
###
# Blog
###
activate :blog
set :blog_permalink, "blog/:category/:title.html"
I was using Middleman 2.15.3 but just tried the approach mentioned above within my Gemfile:
gem 'middleman', :git => 'http://github.com/middleman/middleman'
gem 'middleman-blog', :git => 'http://github.com/middleman/middleman-blog'
My index file which is using a Slim layout template is trying to loop through all my markdown blog files like so:
- data.blog.articles.each_with_index do |article, i|
p==article.title
...but this is throwing an error:
NoMethodError at /
undefined method `blog' for #<Middleman::CoreExtensions::Data::DataObject:0x007fab1419a778>
I'm following how i've setup a previous Haml layout Middleman blog so not sure what the issue is. Thoughts?
from middleman-blog.
I believe you should just do: blog.articles
without the data.
portion. I'm wondering if this is an API change we made and forgot about?
from middleman-blog.
Nah, I've tried that already and get the following error:
NameError at /
undefined local variable or method `blog' for #<#<Class:0x007fab1209acf8>:0x007fab16a97928>
I've handled this in the past with HAML with no problems like so:
%ul.section-content
- data.blog.articles.each_with_index do |article, i|
%li.clickable{:class => (i == 0) ? 'first' : ''}
%h1= article.title
%p=article.summary
from middleman-blog.
Oh, you're on 2.x?
from middleman-blog.
Well originally I was on 2.15.3 but from further research today and reading this post I switched to the latest beta. I was able to get the page to run without errors now, but it's not recognizing any blogs in the "blog" folder.
This is what I have:
- blog.articles.each_with_index do |article, i|
p==article.title
end
I'm going to continue to trouble shoot. Thanks for the quick responses and guidance!
P.S. Just curious but any update on when 3.0 final release will be out?
from middleman-blog.
I think @bhollis may have changed the default location the blog extension looks for articles. Let's ask him.
Regarding 3.0, we'll probably do at least one more beta in 2-3 weeks which should be accompanied by 3.0 versions of all the official extensions. Then on to final, hopefully by the end of May.
from middleman-blog.
I didn't change the default location, but I did fix a bug where it would find "blog-article-like" files anywhere in the source folder.
For reference, I put my blog posts in blog
and here's what I have in config.rb
:
activate :blog
set :blog_permalink, "/blog/:year/:month/:day/:title.html"
set :blog_sources, "blog/:year-:month-:day-:title.html"
set :blog_taglink, "/blog/category/:tag.html"
set :blog_layout, "article"
set :blog_summary_separator, /(<!--more-->)/
set :blog_summary_length, nil
set :blog_year_link, "/blog/:year.html"
set :blog_month_link, "/blog/:year/:month.html"
set :blog_day_link, "/blog/:year/:month/:day.html"
# set :blog_default_extension, ".markdown"
set :blog_tag_template, "blog/tag.html"
set :blog_calendar_template, "blog/calendar.html"
page "/blog/feed.xml", :layout => false
Because that's so verbose, I've been thinking we need some "blog prefix" setting that gets applied to all the paths.
Oh, and yes, things have changed from data.blog.articles
to just blog.articles
. Check out the docs on http://beta.middlemanapp.com/extensions/blog/ for more info.
from middleman-blog.
Pretty sure blog_sources
is new. No? It used to use blog_permalink
in both the reading and output cases.
from middleman-blog.
I just got it to work by moving back to 2.15.3 and using - data.blog.article
. The reason I moved back to 2.15.3 is because I was getting a ruby 1.9.3 error when running beta so I decided to try 2.15.3 again. For now I'm happy but would love to get trying out 3.0 beta so I plan on debugging that issue soon.
Thanks for all the help!
from middleman-blog.
Yeah, blog_sources is new. For what it's worth, I would not say that the new blog extension for 3.0 is compatible with the old extension. Users will likely need to change settings and templates to get it working.
@hershmire, what ruby error were you seeing? I'd like to fix it.
from middleman-blog.
I'm perfectly fine with blog 3.0 not being API compatible.
from middleman-blog.
It's also worth noting that middleman-blog master
is not compatible with the middleman 3.0.beta2 gem, only with middleman master
.
from middleman-blog.
Related Issues (20)
- Add more informations in head of article HOT 2
- Extension should not fail to activate if middleman-core/cli is missing
- Paging on untagged posts HOT 1
- How to make paginate work with localize blog? HOT 2
- Cyrillic tags stopped working in 4.0.2 HOT 2
- Support i18n mount_at_root option in permalinks HOT 3
- 4.0.2 regression bug when specifying the blog in the front-matter HOT 7
- feed.xml error on multi-blog site HOT 1
- RuntimeError flag --blog HOT 1
- 4.0.2 on RubyGems.org has different dependencies to the git repo HOT 3
- Very poor and outdated blog template which does not match with default template HOT 4
- Iterating through blog.tags spits out extraneous frontmatter HOT 5
- How to get links to all calendar/tag pages HOT 5
- Calendar and tag pages without .html aren't rendered within layout automatically HOT 1
- How to configure URLs of articles with underscore HOT 6
- `middleman article` generates incorrect yaml when the title contains characters that should be escaped HOT 1
- Middleman blog frontmatter evaluating files under build directory HOT 3
- preserve i18n locale on non-localized article page HOT 2
- YAML error on Ruby 3.1.0 HOT 7
- Paginate is showing as false even if set in config.rb to true HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from middleman-blog.