EzDevInfo.com

nanoc

nanoc is a web publishing system written in Ruby. nanoc: a static site generator written in Ruby » home

Does nanoc support nested partials?

I am using partials in nanoc, and I was wondering if it's possible to nest partials in nanoc. In other words, can I have a partial within a partial?

When I tested this, the site compiled, but the nested partial did not display.

I'm using the Partials implementation described in this stackoverflow post: Must include files in nanoc always be in the layouts folder?

While nested partials are not required for what we're trying to do, I was just wondering if this is possible.

Thank you in advance.


Source: (StackOverflow)

How can I get Nanoc to compile the same item in more than one way?

I want to have Nanoc compile a single item in multiple formats - specifically, compile a Markdown file to both HTML and PDF. As far as I know, a single item can only match a single compilation rule.

A hard link (ln somefile.md newfile.md) allows me to compile the same file as if it were two different files, but that's kind of an awkward solution.

Is there a better way to do this?


Source: (StackOverflow)

Advertisements

Creating Items for an specific section

I'm building a website with nanoc. I have my main index file and now I want to add a article section with some articles I've written. So I use:

nanoc create_item articles

to create this new section, but how do I create new items within this item I just created?

The url tree I want to achieve would be:

index.html
/articles/index.html
/articles/one.html
/articles/two.html

I now this is very basic stuff but I can't find any examples on the nanoc documentation.


Source: (StackOverflow)

Nanoc layout compile Rules

I'm working with nanoc and I want my index.html to point to specific layout so I created that layout and it is called nosidebar.html

My Rules looks like:

compile 'index.html' do 
  layout 'nosidebar'
end

and this doesn't seem to work. What am I doing wrong?


Source: (StackOverflow)

How can I get the nanoc SASS filter to use SCSS syntax?

In my nanoc site, I want to specify my styles using SCSS:

p {
  em {
    color: red;
  }
}

... not SASS:

p 
  em 
    color: red

But if I try using SCSS, I get a compile error from the SASS filter. How do I get it to use SCSS?


Source: (StackOverflow)

What would be a python alternative to a system like nanoc?

Is there a python publishing system (have no idea whether this is an appropriate name for such a thing, but they're calling it that way) similar to nanoc? Generally, a thing which will convert a lot of markup/asciidoc files to HTML in an orderly fashion?

I know of python-markdown, but one by one page with no support for outside .css pages is not what I'm looking for?

So, is there something python based of more or less this quality?


Source: (StackOverflow)

How add own javascript file to nanoc?

again I have a problem with files in nanoc. This time I wanted to attach custom file slide.js to my blog but I cannot (don't know why - probably something is wrong with my routes). Here's my routes:

compile '/js/*/' do
  # don’t filter or layout
end

...

route '/js/*/' do
  /'js'/ + item.identifier.chop + '.js'
end

And in the head section of my layout I've put: %script{:type => "text/javascript", :src => "/js/slide.js"}/ (yes, it's a HAML).

Can anyone help me to solve this problem? It would be very appreciated.


Source: (StackOverflow)

How to generate pages for each tag in nanoc

I am new to nanoc and I am still finding my around it. I am able to get my site ready, it looks good and functions good, too. But I need to have a tags area. I am able to achieve that with

<%= tags_for(post, params = {:base_url => "http://example.com/tag/"}) %>

But how do I generate pages for tag? So for instance there is a tag called "NFL", so every time a user clicks on it, he/she should be directed to http://example.com/tag/nfl with a list of articles that correspond with NFL.

I can setup a layout which will do that. But then what kind of logic should be I using? And also do I need to have a helper for this?


Source: (StackOverflow)

Merge items in nanoc

I have been trying to use nanoc for generating a static website. I need to organize a complex arrangement pages I want to keep my content DRY.

How does the concept of includes or merges work within the nanoc system? I have read the docs but I can't seem to find what I want.

For example: how can I take two partial content items and merge them together into a new content item.

In staticmatic you can do some like the following inside your page.

= partial('partials/shared/navigation')

How would a similar convention work within nanoc?


Source: (StackOverflow)

nanoc and multiple layouts

is it possible to use multiple layouts for a specific (or all) item(s)? For example, I have a couple of items, and I want to apply two different layouts to it. One with a green and one with a blue background (however). And I want to compile them in two different folders in my output directory (e.g. v1 and v2).

I was playing with the rules and the compile blocks, but I couldn't figure out how this could work. Because, every item gets compiled only one time during the compile process, I can't tell nanoc to compile it the first time with layout1 and the second time with layout2. I tried sth like this, but it led to broken output files.

compile '*' do
  if item.binary?
    # don’t filter binary items
  else
    filter :erb
    layout 'layout1'
    layout 'layout2'
  end
end

Hope I made myself clear and somebody can help.

thx, tux


Source: (StackOverflow)

multiline code block in markdown adds unwanted tabs

today I'm implementing my page in nanoc (haml templates) and I wanted to write some posts in markdown, but when it goes to multiline code blocks something weird is happening - second line in code block has additional tabs. I've tried multiple markdown syntaxes, such as:

//double tab wrapping
    line 1 is fine
    line 2 is wrapping (don't know why!)

and

~~~
//tilde code wrapping
line 1 is fine
line 2 is wrapping
~~~

And both solutions gives me the result something like this:

line 1 is fine
    line 2 is wrapping

Inspecting elements through browser shows that there is no additional padding - this whitespace is made with tabs for sure.
Can someone help me with this? Maybe I'm doing something wrong?


Source: (StackOverflow)

Which Static Web Generator should i use? [closed]

i know average ruby language. i sort out two static web generator Nanoc and Middleman my requirements are:-

  1. easy to customize
  2. easy to learn
  3. more resources to learn

so tell me which one will be better for me Nanoc or Middleman?

Thanks for Reading


Source: (StackOverflow)

PHP code filter in Nanoc's HAML code

I wanted to make a contact form at my nanoc site and I need to put some php code in my .haml file - is there any way (filter maybe?) to easily achieve that or I have to save whole page as a .php (and with stantard html syntax instead of haml one?).

Or maybe there is pure Ruby solution(which can be achieved when hosting on github?)

Please help!


Source: (StackOverflow)

How do I create 'draft' items in nanoc?

I'd like to render posts to different folders depending on a status code in the metadata.

For example, if I have an attribute of status: draft I'd like for these items to be rendered to a folder called /draft/, while status: live would be rendered to /blog/. I could then password protect the draft folder so that only I could view it. If there is no status at all it would default to draft.

Is this possible?


Source: (StackOverflow)

Ruby / nanoc: How do I get a list of items to display in a page?

I fully admit I am a Ruby newb, and this question could come simply out of my ignorance for Ruby.

That being said, I'm getting started with the nanoc project (and loving it). I'd like to power my blog using this ... but: For the life of me, I can't figure out how to get a list of articles / posts to display on the main page. How do I do this?

I'd like to use erb/html if possible.


Source: (StackOverflow)