# help me optimize the code

**URL:** <https://zola.discourse.group/t/help-me-optimize-the-code/2561>\
**Category:** Uncategorized\
**Created:** [March 31, 2025, 12:18pm UTC](https://zola.discourse.group/t/help-me-optimize-the-code/2561 "2025-03-31T12:18:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![husenunicorn](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/husenunicorn/32/1438_2.png) [@husenunicorn](https://zola.discourse.group/u/husenunicorn)\
**Post date:** [March 31, 2025, 12:18pm UTC](https://zola.discourse.group/t/help-me-optimize-the-code/2561/1 "2025-03-31T12:18:00Z")

</div>

can anyone help me optimize the following code, when I activate this code the build time increases, while when I deactivate it the build time decreases by about 2 minutes, my website has 884 pages and 17 sections (multilingual website)

{% if custom.show\_related\_articles %}  
{% set section = get\_section(path=“posts/” ~ “\_index” ~ bahasa ~ “.md”) %}  
{% set\_global read\_more\_posts = %}  
{% for post in section.pages %}  
{% if page.slug == post.slug %}  
{% continue %}  
{% endif %}  
{% set\_global read\_more\_posts = [post] | concat(with=read\_more\_posts) %}  
{% if read\_more\_posts | length \>= 4 %}  
{% break %}  
{% endif %}  
{% endfor %}

```
{% if read_more_posts | length > 0 %}
        <section class="gh-container is-grid gh-outer">
            <div class="gh-container-inner gh-inner">
                <h2 class="gh-container-title">{{bh::get(tr=lang_conf, key="read_more", def="Read more")}}</h2>
                <div class="gh-feed">
                    {% for post in read_more_posts %}
                        {{ pc::postcard(post=post, lazyLoad=true) }}
                    {% endfor %}
                </div>
            </div>
        </section>
    {% endif %}

```

{% endif %}

---

<div class="post-metadata">

**Author:** ![adrianboston](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/adrianboston/32/907_2.png) [@adrianboston](https://zola.discourse.group/u/adrianboston)\
**Post date:** [April 4, 2025, 9:10pm UTC](https://zola.discourse.group/t/help-me-optimize-the-code/2561/2 "2025-04-04T21:10:41Z")

</div>

Related articles … i think you should look at [taxonomies](https://www.getzola.org/documentation/templates/taxonomies/).

and [content for taxonomies](https://www.getzola.org/documentation/content/taxonomies/)

however, perhaps im wrong about your goal.
