Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9140511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:31:33+00:00 2026-06-17T09:31:33+00:00

(Ruby noob) I’m using nanoc to generate a site. Here is my sample page

  • 0

(Ruby noob)
I’m using nanoc to generate a site. Here is my sample page with metadata:

--- 
title: abc
parameters:
    abc: def
    ghi: ijk
---

test

I know that I can have parameters one level up but I want to access them in layout file:

<%= @item[:parameters][:abc] %>

but I got following error:

undefined method `[]' for nil:NilClass

Parameters are passed to layout because when I do:

<%= YAML::dump(@item[:parameters]) %>

I can see them. As a Ruby noob I think there’s a simple solution to my problem. Also, if you could post a snippet iterating through :parameters hash I would be grateful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:31:33+00:00Added an answer on June 17, 2026 at 9:31 am

    You probably have more than one page on your site. Therefore parameters does not exist in the layout for every page nanoc processes. For some pages the element will be nil and hence the error you get.

    Perhaps you need to rethink how you want to use those parameters, or then you need a conditional in your layout to look for parameters and only use them when they are present:

    <% if @item[:parameters] %>
     <%= @item[:parameters][:abc] %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Noob question for Ruby on Rails- here's an example of my situation: If I
Ruby noob here. Any help with a little issue I'm having would be appreciated.
(ruby noob here..apologies if I'm not asking the question correctly) So I have two
Using python to pick it some pieces so definitely a noob ? here but
Ruby noob here! I have an array of structs that look like this Token
Ruby noob here. Trying to display a list of points as a polygon on
Kind of a ruby-noob active record query question: Magazine has_many :subscriptions User has_many :subscriptions
First of all you have to know I'm total Ruby noob :) I installed
I am a bit of a Ruby noob when it comes to the more
I am building an application using Ruby on Rails. I want to do something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.