How to use custom variables into posts loop

Hello!

Let me ask please one question.

There I’m looking loop for posts into the category: https://jekyllrb.com/docs/posts/

Here is code:

{% for category in site.categories %}
  <h3>{{ category[0] }}</h3>
  <ul>
    {% for post in category[1] %}
      <li><a href="{{ post.url }}">{{ post.title }}</a></li>
    {% endfor %}
  </ul>
{% endfor %}

But I have one question. Can I use created custom variables instead of default Post Title into loop?

For example, I create a variable: shorttitle for posts, where write short version of the title. And for categories I want to display short version of the title, not full title: {{ post.title }}.

If I write {{post.shorttitle}}, it’s not working. Please, can someone give me advices. And sorry for bad English!

you should be able to do that.

Is there a repo we can look at?

sorry rdyar, I’m foolish. There was be error on code syntax. Now all works fine!