Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

The number zero in headers

Started by Muut Archive 10 years ago · 2 replies · 333 views
10 years ago

I'm having an issue with the number zero in headers. I have a list of items who need to have 3 digits associated with them. They range from 001 to over 100. Every number starting with a zero is giving me problems. Every time i try adding 001 to the header, it gets automatically reduced to 1.

Basically, this is what I'm doing:
item:
num: 001
name: itemname

But its getting converted to
item:
num: 1
name: itemname

I've tried both the editor in expert mode and editing the .md file with a text editor. When editing the .md file directly, It will show up in the editor as "001" but in practice, its still converted to 1. When you go to save the file, it will show the "1" in the editor again as well.

I've gone through the documents and haven't come across anything related to it. Is there something I am doing wrong?

10 years ago

This is just a matter of how YAML works. If you add a numeric value without quotes, it will assume you are adding an integer so it converts 001 to 1.

You probably need to just wrap it in quotes so that it's treated like a string: "001"

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1352 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4064 9 years ago
Archive · by Muut Archive, 9 years ago
1 2949 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago