Skip to content

Conversation

@haroun
Copy link
Contributor

@haroun haroun commented Sep 10, 2025

Summary

Add prepend-main and append-main

What are the specific steps to test this change?

Please check apostrophecms/starter-kit-astro-apollo-assembly#1

What kind of change does this PR introduce?

(Check at least one)

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Build-related changes
  • Other

Make sure the PR fulfills these requirements:

  • It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • The changelog is updated
  • Related documentation has been updated
  • Related tests have been updated

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

@haroun haroun self-assigned this Sep 10, 2025
@linear
Copy link

linear bot commented Sep 10, 2025

<div data-apos-refreshable>
{% block beforeMain %}{% endblock %}
{% block mainAnchor %}<a name="main"></a>{% endblock %}
{% component '@apostrophecms/template:inject' with { where: 'main', end: 'prepend', when: 'hmr' } %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this line with hmr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when: 'hmr' means "inject only when in HMR mode". It wasn't added probably due to performance reasons (with the idea "add it if/when needed".

@haroun haroun requested review from boutell and myovchev September 10, 2025 13:43
Copy link
Member

@boutell boutell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't actually go inside the <main> element, which is supplied by project level layout.

So this is essentially beforeMain and afterMain in node injection form. So I would go with those names.

Copy link
Member

@boutell boutell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually my suggestion is not possible because of the way "prependNodes" and "appendNodes" work.

So I'm going to approve this as written because I don't have a better suggestion.

@haroun haroun merged commit 31b8409 into main Sep 11, 2025
6 checks passed
@haroun haroun deleted the pro-8178-add-prepend-append-main branch September 11, 2025 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants