each_with_indexで番号を取る
- current_page.data.test_list.each_with_index do |test, index| .number= index + 1 .test-box= test
説明
front matterでtest_listに数値をセットして、
.test-box
に入れる_with_index
をつけると0,1,2,3,4,5,,,という数字をとれるindexは0から始まるので
+1
をつけて.number
に入れる
すると、test_listにある数値の分だけindexも繰り返して表示できる
each_with_index (Enumerable) - Rubyリファレンス