Giter VIP home page Giter VIP logo

middleman-blog's Introduction

Middleman - Makes developing websites simple

Gem Version CI License

Middleman is a static site generator using all the shortcuts and tools in modern web development. Check out middlemanapp.com for detailed tutorials, including a getting started guide.

Why Middleman?

These days, many websites are built with an API in mind. Rather than package the frontend and the backend together, both can be built and deployed independently using the public API to pull data from the backend and display it on the frontend. Static websites are incredibly fast and require very little RAM. A front-end built to stand-alone can be deployed directly to the cloud or a CDN. Many designers and developers simply deliver static HTML/JS/CSS to their clients.

  • Uses Sass for DRY stylesheets.
  • Bring your own asset pipeline (WebPack, Babel, Sprockets or any other).
  • Easy templating with ERb or Haml.

Middleman gives the stand-alone developer access to all these tools and many, many more.

Installation

Middleman is built on Ruby and uses the RubyGems package manager for installation. These are usually pre-installed on Mac OS X and Linux. Windows users can install both using RubyInstaller. For windows RubyInstaller-Devkit is also required.

gem install middleman

Getting Started

Once Middleman is installed, you will have access to the middleman command. First, let's create a new project. From the terminal:

middleman init MY_PROJECT

This will create a new Middleman project located in the "MY_PROJECT" directory. This project contains a config.rb file for configuring Middleman and a source directory for storing your pages, stylesheets, javascripts and images.

Change directories into your new project and start the preview server:

cd MY_PROJECT
middleman server

The preview server allows you to build your site, by modifying the contents of the source directory, and see your changes reflected in the browser at: http://localhost:4567/

To get started, simply develop as you normally would by building HTML, CSS, and Javascript in the source directory. When you're ready to use more complex templates, simply add the templating engine's extension to the file and start writing in that format.

For example, say I am working on a stylesheet at source/stylesheets/site.css and I'd like to start using Compass and Sass. I would rename the file to source/stylesheets/site.css.scss and Middleman will automatically begin processing that file as Sass. The same would apply to CoffeeScript (.js.coffee), Haml (.html.haml) and any other templating engine you might want to use.

Finally, you will want to build your project into a stand-alone site. From the project directory:

middleman build

This will compile your templates and output a stand-alone site which can be easily hosted or delivered to your client. The build step can also compress images, employ Javascript & CSS dependency management, minify Javascript & CSS and run additional code of your choice. Take a look at the config.rb file to see some of the most common extensions which can be activated.

Learn More

A full set of in-depth instructional guides are available on the official website at: http://middlemanapp.com.

Additionally, up-to-date generated code documentation is available on RubyDoc.

Community

The official community forum is available at: http://forum.middlemanapp.com

Bug Reports

Github Issues are used for managing bug reports and feature requests. If you run into issues, please search the issues and submit new problems: https://github.com/middleman/middleman/issues

The best way to get quick responses to your issues and swift fixes to your bugs is to submit detailed bug reports, include test cases and respond to developer questions in a timely manner. Even better, if you know Ruby, you can submit Pull Requests containing Cucumber Features which describe how your feature should work or exploit the bug you are submitting.

How to Run Cucumber Tests

  1. Checkout Repository: git clone https://github.com/middleman/middleman.git
  2. Install Bundler: gem install bundler
  3. Run bundle install inside the project root to install the gem dependencies.
  4. Run test cases: bundle exec rake test

Donate

Click here to lend your support to Middleman

Versioning

This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, that version should be immediately yanked and/or a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions. As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision. For example:

gem 'middleman', '~> 4.0'

License

Copyright (c) 2010-2023 Thomas Reynolds. MIT Licensed, see LICENSE for details.

middleman-blog's People

Contributors

adamesque avatar andrewkvalheim avatar barraponto avatar bhollis avatar cllns avatar danielbayerlein avatar dgalarza avatar ebouchut avatar fuhrmann avatar fukayatsu avatar ikuwow avatar iwarner avatar karlfreeman avatar kimisaraz avatar koppen avatar manuelmeurer avatar markets avatar mikekolganov avatar pusewicz avatar remino avatar richardkall avatar rmm5t avatar robb1e avatar rriemann avatar rumpuslabs avatar soulou avatar tdreyno avatar thesmartnik avatar tricknotes avatar xanders avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

middleman-blog's Issues

Linkblog-type entries

I am looking to create some posts in a blog that are of the link-style, probably made most famous by Gruber's DaringFireball.

Not all posts will necessarily be of this type, but I would like to see if it can be done.

There is a technique for doing this in Octopress at http://www.cnnr.me/b/2012/01/how-to-link-to-other-posts-in-octopress/

This looks a bit messy though, and I am not sure I like having those if statements in the template.

I am new to middleman, but I will give it a try. I wanted to get it out there in case any one had any pointers on how best to do this.

Thanks, Steve

Allow Multiple Blogs

I'm thinking we should re-org our internals a little more. @bhollis has already done a ton.

I think we need a root Blog class which is initialized with a hash, instead of the set variable methods.

Old format:

activate :blog
set :blog_permalink, ":year/:month/:day/:title.html"

New format:

activate :blog, :permalink => "blog1/:year/:month/:day/:title.html"
activate :blog, :permalink => "blog2/:year/:month/:day/:title.html"

Adding standalone pages with custom permalinks?

I'm trying to add an About page to my middleman blog. To do this I added an "about.markdown" file in my source/ directory. Running middleman build correctly generated about.html in the correct location. I would, however, like to have this custom page generated as :title/index.html i.e. it should generate about/index.html so that I can access the page as http://myWebSite/about/

How could I do this?

Is there support for per-page permalinks in the YAML frontmatter?

Set article date based on filename

We include the date in the filename of the article, but then require it again in frontmatter and only use the frontmatter date. It should be implicitly set by the filename.

Layout not getting title from blog index frontmatter

Hi,

when I set a title on the blog index page frontmatter, the title passed to the layout, through data.page.title, is the one of the last article on the index page, not the one on the frontmatter section.

Calendar page giving out "negative argument" error

Hello, i've setup my blog extension like this (excerpt from config.rb):

activate :blog do |blog|
blog.prefix = "blog"
blog.permalink = ":year/:month/:day/:title.html"
blog.taglink = "tags/:tag.html"
blog.paginate = true
blog.page_link = "p:num"
blog.per_page = 20
blog.tag_template = "blog/tag.html"
blog.calendar_template = "blog/calendar.html"
end

For some reason, when i attempt to go to "/blog/2012.html" the calendar template (i'm assuming) throws out an Internal Server Error saying "negative argument".

Any ideas why that might be?

Thanks in advance,
Pedro

Tag and calendar pages don't update in preview server

Because of the way tag and calendar pages are generated (as proxies after_configuration), they don't update when pages change. The global list of tags is also not recalculated. This means adding or removing a tag from posts while the server is running won't be reflected in any tag lists and new tags won't have a page.

Feed.xml creating errors

File /source/feed.xml.builder with this code, when I build html:

/Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/tilt-1.3.3/lib/tilt/template.rb:108:in `require': cannot load such file -- builder (LoadError)
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/tilt-1.3.3/lib/tilt/template.rb:108:in `require_template_library'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/tilt-1.3.3/lib/tilt/builder.rb:14:in `initialize_engine'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/tilt-1.3.3/lib/tilt/template.rb:55:in `initialize'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/tilt-1.3.3/lib/tilt.rb:98:in `new'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/tilt-1.3.3/lib/tilt.rb:98:in `block in []'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/tilt-1.3.3/lib/tilt.rb:96:in `each'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/tilt-1.3.3/lib/tilt.rb:96:in `[]'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/sitemap/store.rb:189:in `extensionless_path'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/sitemap/store.rb:178:in `file_to_path'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/sitemap/extensions/on_disk.rb:45:in `touch_file'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/sitemap/extensions/on_disk.rb:24:in `block in initialize'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:158:in `instance_exec'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:158:in `block in run_callbacks'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:156:in `each'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:156:in `run_callbacks'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:94:in `did_change'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:126:in `block (2 levels) in reload_path'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:122:in `each'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:122:in `block in reload_path'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:115:in `chdir'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:115:in `reload_path'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/file_watcher.rb:37:in `block in registered'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb:53:in `instance_exec'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb:53:in `block in run_hook_for'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb:49:in `each'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb:49:in `run_hook_for'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb:107:in `run_hook'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/request.rb:57:in `inst'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/cli/build.rb:85:in `shared_instance'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/cli/build.rb:56:in `build'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/task.rb:27:in `run'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/invocation.rb:120:in `invoke_task'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor.rb:275:in `dispatch'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/base.rb:425:in `start'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/cli.rb:77:in `method_missing'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/task.rb:29:in `run'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/task.rb:126:in `run'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/invocation.rb:120:in `invoke_task'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor.rb:275:in `dispatch'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/base.rb:425:in `start'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/lib/middleman-core/cli.rb:22:in `start'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/gems/middleman-core-3.0.6/bin/middleman:18:in `<top (required)>'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/bin/middleman:23:in `load'
  from /Users/artemeff/.rvm/gems/ruby-1.9.3-p194/bin/middleman:23:in `<main>'

Index Pagination

I'm working on adding pagination to the index of my blog. I'd like to get the code generalized at some point to be used by others.

Allow posts to have a different source layout than their permalink

I blog infrequently, so having a directory structure that matches my permalink structure means I'll have a lot of deep directories with only one post in each. I'd prefer if the blog extension at least had an option to work a bit more like Jekyll, where posts can all be stored in one folder, and then are rendered to folders for permalinks. For example, I might have a post:

2011-12-13-middleman-is-awesome.md

Which would produce the output file:

2011/12/13/middleman-is-awesome.html

Actually, since the date is in the frontmatter anyway, I should be able to structure my posts any way I like and still have them output in my preferred permalink structure. Perhaps a setting where I can give the regex I like - for me, "blog/*.md" is enough to specify my posts.

Should allow --bundler flag during init

Current issue:

middleman init my_blog --bundler --template=blog
      create  my_blog/config.ru
Could not find "shared/Gemfile.tt" in any of your source paths. Your current source paths are: 

/Library/Ruby/Gems/1.8/gems/middleman-blog-0.1.5/lib/middleman-blog

Right now, the Gemfile template (Gemfile.tt) is in the middleman gem, should add one to middleman-blog which also includes the blog gem (duh).

No available mm-blog gem with date fixes

Commit: eaf4e7a is not included in 0.1.4.

I locally created a "0.1.5" version on above commit and it seems to work.

I know mm 3.0 is WIP, but not having a usable set of default gems for ruby 1.9.2 is a little annoying.

Thanks.

Allow a blog article to have its own layout

Hi,

All articles use the layout set for the blog in config.rb and cannot be overridden by the YAML front matter, like it can be done with normal pages.

I'm still figuring out your code, so I haven't been able to fork it and edit it yet, but I'm guessing it has to do with the render method in /lib/middleman-blog/blog_article.rb not considering the front matter of articles.

Also, I'm not sure if this is a bug or if this was done by design.

html.markdown pages do not render

https://github.com/tdreyno/middleman-blog/blob/master/lib/middleman-blog/feature.rb#L77-78

          engine = app.settings.markdown_engine.new { sum }
          data["summary"] = engine.render

app.settings.markdown_engine.new is returning the symbol :maruku, then .new tries to create an instance of that symbol which results in:

/Users/bgessler/Projects/middleman-blog/lib/middleman-blog/feature.rb in block (2 levels) in registered
              engine = app.settings.markdown_engine.new { sum }
/Users/bgessler/Projects/middleman-blog/lib/middleman-blog/feature.rb in map
            articles = Dir[articles_glob].map do |article|
/Users/bgessler/Projects/middleman-blog/lib/middleman-blog/feature.rb in block in registered
            articles = Dir[articles_glob].map do |article|
/Users/bgessler/Projects/middleman-blog/lib/middleman-blog/feature.rb in block (2 levels) in registered
              })

Support UTF-8 Characters in File Names

I do know if this is an issue with middleman or middleman-blog, but it fails to find blog articles that have non-ASCII characters in the file name. This means that the blog title and the file name have to be different. In the case of Latin-based languages, the file name has to be stripped of accents.

Default feeds

Right now our template ships with feed.xml.builder, but who's really going to customize that? We should ship with a default feed implementation that uses an in-gem template instead of relying on users to generate feeds themselves. If we do that, we can easily do per-tag feeds too.

Article template should behave like a layout

I spent a while running around in circles trying to get the blog extension working on master after reading the docs - I didn't realize that I needed to do that special trick in my layout where I explicitly render my content into the _article_template.erb. It'd be much more straightforward if the article template was simply applied like a layout around blog post content, and then render the result into the regular layout.

The project documentation is not at all clear how to enable tags.

I'm using the Middleman Blog guide for reference material.

$ gem install middleman
********************************************************************************

  Welcome to Middleman 2.0

  In addition to many new features, some backwards-incompatible
  changes have been made to the structure of Middleman sites.

  Before running you old, v1.x project on Middleman 2.0,
  review the Migration guide:

  http://middlemanapp.com/guides/migrating

********************************************************************************
Successfully installed middleman-2.0.14
1 gem installed

$ gem install middleman-blog
Successfully installed middleman-blog-0.1.3
1 gem installed

$ middleman init blogtagblues --template=blog                                  
/home/blt/.rvm/gems/ruby-1.9.3-p0/gems/middleman-2.0.14/lib/middleman/guard.rb:
5: Use RbConfig instead of obsolete and deprecated Config.
      create  blogtagblues/config.ru
      create  blogtagblues/config.rb
      create  blogtagblues/source
      create  blogtagblues/source/2011/01/01/new-article.html.markdown
      create  blogtagblues/source/_article_template.erb
      create  blogtagblues/source/archives/index.html.erb
      create  blogtagblues/source/feed.xml.builder
      create  blogtagblues/source/index.html.erb
      create  blogtagblues/source/layout.erb
      create  blogtagblues/source/stylesheets
      create  blogtagblues/source/javascripts
      create  blogtagblues/source/images

You may find blogtagblues here. I edit source/2011/01/01/new-article.html.markdown to look like so:


--- 
title: "New Article title"
date: 01/01/2011
tags: blogging

---

Content of my article

and find that, after I've started up middleman server for this project I'm greeted with the exception:

NameError at /
undefined local variable or method `blog_taglink' for #<#<Class:0x9c948bc>:0xaef6a64>
file: feature.rb location: block (3 levels) in registered line: 96

blog template not generating blog files

With middleman master and middleman-blog master checked out (and referenced in a Gemfile), running

bundle exec middleman init . --template=blog

just produces the normal template. At the very least I'd expect the template option to error out if no matching template were present.

Cannot generate tag pages with blog.tag_template

My config.rb:

activate :blog do |blog|
  blog.layout = "article"
  blog.taglink = "metadata/:tag.html"
  blog.tag_template = "source/tag.html.erb"
end

When I middleman build I get:

error  build/metadata/beta.html
Path metadata/beta.html proxies to unknown file source/tag.html.erb

No matter where I put tag.html.erb or what I name it, I get the same error. It seems there is a problem with the proxy?

I'm using v3.0.0.beta.3 for both blog and middleman

Docs relating to prefix/sources/permalink are not entirely clear

Initially I had trouble defining blog.source/blog.permalink in conjunction with blog.prefix. The docs don't make it obvious that something like the following will result in no source files being found:

blog.prefix = "news/"
blog.permalink = "news/:year-:month-:title"
blog.sources = "news/:year-:month-:title"

This won't work because the prefix is ALWAYS prepended to permalink/sources. I was quite confused until I poked around the prefixing code.

It would be sufficient to simply note that the source dir should only be defined in either the permalink/source or the prefix.

Calendar and Tag templates should use articles, not page_articles

The default templates generated for calendar and tag loop through page_articles. This shows all the articles in the entire blog, instead of the appropriate subset for the year or tag.

I believe the templates should be using the articles local variable instead.

Blog summaries don't properly render content

My and @tdreyno's initial attempt at producing blog summaries didn't work because it would split tags, sometimes causing invalid HTML. @rumpuslabs fixed it to truncate the template, then render, which sounds better, except:

  • It doesn't work for ERb templates, or Liquid, or Haml, or anything but Markdown really.
  • Even in Markdown, if you use footnote-style links, none of your links render correctly in the summary.

The correct solution would be to use Nokogiri to parse the rendered content, then iterate through the nodes, adding whole elements until the total text length got past a certain point. This would necessitate adding a dependency on nokogiri to middleman-blog. Alternately, we could just drop the summary-based-on-length feature and require people place a break point in their blog posts.

No longer able to have source file filename not include :day

With an old version of the extension I was able to have have source files such as 2012-01-blogpost.html.markdown

In theory this seems like it should be possible, by simply doing blog.sources = ":year-:month-:title.html" but this does not work, the following error is thrown:

/projects/mm-blog-test/vendor/bundler/gems/middleman-blog-3.0.0/lib/middleman-blog/blog_data.rb:80:insub': can't convert nil into String (TypeError)`

Apparently because of resource.slug = $4 on line 76 of blog_data.rb.

Thanks.

Standalone pages alongside of blog

I'm trying to create other standalone pages (in addition to the index page) along with the blog extension. It seems the is_blog_article? function returns true for these non-blog pages. I get the following exception:

TypeError at /about.html
can't convert nil into String
file: feature.rb location: parse line: 120

/Users/matt/Web/svn/phaseshift_website/source/_article_template.erb in evaluate_source
   <time class="updated" pubdate><%= current_article_date.strftime('%b %e %Y') %></time>
/Users/matt/Web/svn/phaseshift_website/source/layout.erb in evaluate_source
   <%= partial settings.blog_article_template %>

Here's the excerpt from my layout.erb file:

<% if is_blog_article? %>
  <% content_for :blog_article, yield %>
  <%= partial settings.blog_article_template %>
<% else %>
  <%= yield %>
<% end %>

My _article_template.erb is as follows:

<article class="hentry">
  <h2 class="entry-title">
    <%= current_article_title %> 
    <time class="updated" pubdate><%= current_article_date.strftime('%b %e %Y') %></time>
  </h2>

  <div class="entry-content">
    <%= yield_content :blog_article %>
  </div>
</article>

Middleman server crashes after installing middleman-blog

I am running middleman 3.0.0.rc1 on Ubuntu 12.04 using rvm and MRI ruby 1.9.2

Here are the steps to reproduce this problem:

$ gem install middleman --pre
$ middleman init mm
$ cd mm
$ bundle
$ middleman

Everything works fine at this point.

Add gem "middleman-blog", "~> 3.0.0.rc1" to Gemfile

$ bundle
$ middleman init . --template=blog
$ middleman
== The Middleman is loading
/home/hectorsq/.rvm/gems/ruby-1.9.2-p290@middleman/gems/tilt-1.3.3/lib/tilt/template.rb:108:in `require': no such file to load -- builder (LoadError)

Installing builder gem manually does not solve the problem.

UTC vs. local time causes errors

Hi,

I live in Japan Standard Time (JST), GST+09:00.

I have several past articles created in the morning before 9am, local time, that will now raise an exception today when I try to build the site. The URL to the article uses UTC while the article's metadata uses local time, and Middleman Blog doesn't like it.

For example, let's say I have an article source file named 2012-01-01-happy-new-year.html.markdown, with the date in its metadata set as date: 2012-01-01 01:00 +09:00, when building the site, Middleman Blog will convert the metadata to UTC and think the file name is incorrect as it should match 2011-12-31-happy-new-year.html.markdown instead, raising this exception:

/Users/remi/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/middleman-blog-3.1.1/lib/middleman-blog/blog_article.rb:127:in `date': The date in articles/2011-12-31-happy-new-year.html's filenam
e doesn't match the date in its frontmatter (RuntimeError)

In my opinion, since my blog is only authored by myself, the local time should prevail. Before I dig into the code to fix this, if need be, I want to know the opinion of others on this.

Cannot wrap_layout within a blog post

So, I attempted to use wrap_layout within a blog post to get it working as we'd hope but... it doesn't seem to work as you'd expect. I tried taking a stab at the code but got a bit lost in middleman-core's rendering area.

When you attempt to wrap_layout, you only get the layout you specified and not the layout as called in the wrap_layout.

I will provide code that shows the failing feature.

Related posts

I was wondering if there's a way to get a list of relevant posts per article?

Granular date and time control when publishing articles

Specifically when publishing multiple articles on one day. I currently I have a loop that looks like the following:

<% data.blog.articles[0...5].each do |article| %>
  <article>
    ...article content...
  </article>
<% end %>

Which lists the 5 most recent articles on my index page, but when I publish more than one article per day it sorts them in chronological order, where I would like them to be reverse chron, like a blog typically is. Is there an easy way to reorder this so it works in a typical blog format, with the newest article of that day appearing first?

Post summary without headers

When I create a blog post with a header and a few paragraphs, the summary shows me the first paragraph and the header. Is there a way to strip out the first header in the summary?
I would guess that this is the preferred behavior for must users.

Tag pages don't work

If I set up a new blog project and add a tag to an article (exactly the same as the example in #14), going to the tag's page (tags/blogging.html, for example) returns a File Not Found. The page is also missing when building the project. According to the docs:

Simply add tag frontmatter to your articles and they will be organized on a tag page at tags/TAGNAME.html by default.

NoMethodError when attempting to view an article (permalink)

I'm getting an error when attempting to run a freshly (had to make my own _article_template.erb) generated blog with middleman. The details are below, let me know if you need any other info, or want me to try anything out to fix it.

Error

private method `gsub!' called for #Array:0x10ba7aa10 @ Line 53

            app.get("/#{app.blog_permalink}") do
              process_request({
                :layout        => app.blog_layout,
                :layout_engine => app.blog_layout_engine
              })

              # No need for separator on permalink page
              body body.gsub!(app.blog_summary_separator, "")

Steps to repro

  1. gem install middleman
  2. gem install middleman-blog
    • gem install maruku
    • gem install builder
  3. middleman init appName --template=blog
  4. Create _article_template.erb and copied code from github (should be in the template already?)
  5. middleman server
  6. Click on the article hyperlink

System Info

OS X Snow Leopard
Default Ruby Install (Ruby 1.8.7)

`current_article` nil during build

We're using a custom layout for the articles through nested layouts:

/config.rb

activate :blog do |blog|
  blog.layout  = "article_layout"
  # ...
end

/source/article_layout.haml

- wrap_layout :layout do
  %h2 Blog

  %article
    %h3= current_article.title

  %section.body   
    = yield

This works fine while running the preview server, but during build we're getting

$ middleman build --debug

…

error  build/article_layout.html
path/source/article_layout.haml:5:in `block (2 levels) in evaluate_source': undefined method `title' for nil:NilClass (NoMethodError)

Any idea what's going wrong here? Are we using the layouts wrong?

How can I link to next and previous article?

Hey guys, I'm trying to add a next and prev article navigation functionality to my blog. However I couldn't make it work :( I tried to use next_article and prev_article but it didn't work.

A screenshot to illustrate what I'm trying to do: http://cl.ly/JdQX

Is it possible to do this with middleman?

Allow future-dated posts

Since @bhollis added the ability to leave posts unpublished, I was thinking it might also make sense to extend BlogArticle#published? to also check whether the article's date is later than the current time. This would allow e.g. automatic posting using a cron job to regenerate your site regularly - as soon as the post is no longer future-dated it will be published.

I ran into problems though, because DateTime.parse and Date#to_datetime assume that the given date is in UTC unless the timezone is explicitly specified. ActiveSupport has a lot of date/time/timezone handling code that I could use to solve this problem but it adds a dependency on the tzinfo gem.

Is this worth pursuing?

Depends on a non-existent version of Middleman

The gem requires version 2.1.0.pre of Middleman, which doesn't exist.

Using Middleman version 2.0.14.pre2 and 3.0.0.alpha.2 I get this error:
/Users/jesper/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/middleman-3.0.0.alpha.2/lib/middleman/core_extensions/features.rb:102:in 'instance_eval': uninitialized constant Middleman::Features::Blog (NameError)

Which version of Middleman supports the blog extension?

Cant get blog layout to work

I want to use a layout for the blog, but it isn't using the layout file. What am I doing wrong?

This is my config.rb

activate :blog do |blog|
blog.prefix = "blog"
blog.layout = "blog_layout"
end

the blog_layout.erb sits in the "blog"-directory in the source folder.
Do I have to place this file somewhere else?

Thanks
Nick

Instance variables not being cleared between pages

I've noticed a couple of times that e.g. the year calendar page sometimes has the @month or @day variables set but haven't been able to pin it down until I tried combining my tag and calendar pages into a single template.

Here is a commit with some failing tests that demonstrate the problem: rumpuslabs/middleman-blog@8af45b9c8f47d4dde50d492666d8377026b29e65 (pull the instance_vars_bug branch)

If I figure out what's going on and manage to fix it I'll turn this into a pull request, in the meantime if anyone has any ideas...

Support Markdown Custom Options

Make sure markdown config options like this:

set :markdown, :smartypants => true

Is actually used. Works in normal Middleman, but not in the blog extension.

Error using Slim as a template language

Hello,

I was getting some serious errors trying to use Slim as a default template language. I already installed the slim gem, replaced layout.erb to layout.slim and here's my config.rb:

activate :blog
set :blog_permalink, ":year-:month-:day-:title.html"
# set :blog_summary_separator, /READMORE/
# set :blog_summary_length, 500
set :blog_layout_engine, "slim"

page "/feed.xml", :layout => false

# Build-specific configuration
configure :build do
  # For example, change the Compass output style for deployment
  activate :minify_css

  # Minify Javascript on build
  activate :minify_javascript

  # Enable cache buster
  # activate :cache_buster
end

So, what's wrong?

Generate date-and-tag-based index pages

The source includes the blog_index_template setting, and the docs reference it, but it doesn't look like it's actually used. I'm guessing it was intended for a feature that would generate index pages based on dates (year's posts, month's posts, etc) and tags (again, as mentioned by the docs). Right now it looks like if you wanted those types of pages you'd have to build them yourself via helpers/proxy (see issue #6). It'd be great if the blog extension did this stuff.

Dynamic pagination links

Hi all,

I'm currently using Middleman inside a subdirectory on my domain (relative_assets turned on), so I was wondering if it was possible for next_page and prev_page to be "dynamic" links (not relative to root). Right now it seems they're always relative to root.

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.