2015-12-08 1 views
0

J'ai un blog Middleman avec des fichiers post dans source/journal.Utilisation de haml pour poster des fichiers avec un blog intermédiaire

Ma config blog:

activate :blog do |blog| 
    # set options on blog 
    blog.prefix = "journal" 
    blog.permalink = "{year}-{month}-{day}-{title}.html.haml" 
    blog.sources = "{title}.html.haml" 
    blog.layout = "journal_layout" 
end 

Et un fichier post dans la source/Journal/02/12/2015-bonjour-world.html.haml

\--- 
title: Hello World 
date: 2015-12-02 
category: Photography 
\--- 

%article 
    %h1 Hello World 
    %p Denver, Colorado :: December 2nd, 2015 
    %p Lore ipsum dolar 

Je peux tirer vers le haut la page avec une URL directe, mais le poste n'enregistre pas:

- blog.articles[0...5].each do |article| 
    %article 
    %h2= link_to article.title, article.url 

... et le frontmatter apparaît comme le texte brut en haut de la page.

Un grand merci pour votre temps.

MISE À JOUR!

config blog doit être:

activate :blog do |blog| 
    # set options on blog 
    blog.prefix = "journal" 
    blog.permalink = "{year}-{month}-{day}-{title}.html" 
    blog.sources = "{year}-{month}-{day}-{title}.html.haml" 
    blog.layout = "journal_layout" 
end 

et le fichier HAML article:

--- 
title: Hello World 
date: 2015-12-02 
category: Photography 
--- 

%article 
    %h1 Hello World 
    %p Denver, Colorado :: December 2nd, 2015 
    %p Lore ipsum dolar 

Répondre

0

Le problème est que vous incluez la pleine extension de fichier ".html.haml", mais ce que le blog middleman L'extension attend est l'extension de fichier finale (traitée) qui est simplement ".html".

Changer la configuration de votre blog à ce qui suit et il devrait fonctionner:

activate :blog do |blog| 
    # set options on blog 
    blog.prefix = "journal" 
    blog.permalink = "{year}-{month}-{day}-{title}.html" 
    blog.sources = "{title}.html" 
    blog.layout = "journal_layout" 
end 
+0

Merci Torbinsky! Cela a fonctionné parfaitement. – user1515340