سؤال

So just to clarify an extension in app/code (or via composer) not a theme app/design which would need to be applied.

I've read https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/layout-create.html

Reason I ask is because if you want to generate a layout that could be universal to different projects i.e. a subcategory view - so something that is independent of the chosen theme.

I've seen others approach with the use of category attributes e.g.

https://www.magebees.com/subcategory-listing-extension-for-magento-2.html

enter image description here

But that to me seems a workaround.

Can you add page layout via extension?

Not theme.

هل كانت مفيدة؟

المحلول 2

Finally got round to working on a solution

I've created an extension to this

https://github.com/DominicWatts/Subcategory

Adding page layout via extension. Only changes within theme are covered in development docs (https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/layout-create.html) and I've seen some creative solutions online to a relatively simple issue.

I've created a generic extension which can be used on multiple themes.

نصائح أخرى

The answer is yes, and I think you have the answer of how to do it in the link you provided yourself from the devdocs.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top