Giter VIP home page Giter VIP logo

Comments (19)

bhollis avatar bhollis commented on July 27, 2024

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.

lucassmagal avatar lucassmagal commented on July 27, 2024

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.

bhollis avatar bhollis commented on July 27, 2024

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.

tdreyno avatar tdreyno commented on July 27, 2024

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.

lucassmagal avatar lucassmagal commented on July 27, 2024

@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.

bhollis avatar bhollis commented on July 27, 2024

What errors are you getting?

from middleman-blog.

bhollis avatar bhollis commented on July 27, 2024

I think I fixed the error you were seeing.

from middleman-blog.

hershmire avatar hershmire commented on July 27, 2024

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.

tdreyno avatar tdreyno commented on July 27, 2024

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.

hershmire avatar hershmire commented on July 27, 2024

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.

tdreyno avatar tdreyno commented on July 27, 2024

Oh, you're on 2.x?

from middleman-blog.

hershmire avatar hershmire commented on July 27, 2024

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.

tdreyno avatar tdreyno commented on July 27, 2024

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.

bhollis avatar bhollis commented on July 27, 2024

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.

tdreyno avatar tdreyno commented on July 27, 2024

Pretty sure blog_sources is new. No? It used to use blog_permalink in both the reading and output cases.

from middleman-blog.

hershmire avatar hershmire commented on July 27, 2024

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.

bhollis avatar bhollis commented on July 27, 2024

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.

tdreyno avatar tdreyno commented on July 27, 2024

I'm perfectly fine with blog 3.0 not being API compatible.

from middleman-blog.

bhollis avatar bhollis commented on July 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.