zola icon indicating copy to clipboard operation
zola copied to clipboard

Context is lost when rendernig shortcode insede shortcode

Open bemyak opened this issue 1 year ago • 1 comments

Bug Report

Environment

Zola version: 0.16.1

Expected Behavior

When a shortcode is passed to a body of another shortcode, it should render in the parent's context.

Current Behavior

The only variable present in the child's context is nth

Step to reproduce

Build the attached website and check out the /post/ page:

Parent context: { "body": "{{ context() }}", "config": { "base_url": "http://127.0.0.1:1111/", "mode": "serve", "title": null, "description": null, "languages": {}, "default_language": "en", "generate_feed": false, "feed_filename": "atom.xml", "taxonomies": [], "build_search_index": false, "extra": {} }, "lang": "en", "nth": 1, "page": { "relative_path": "post.md", "content": "", "permalink": "http://127.0.0.1:1111/post/", "slug": "post", "ancestors": [ "_index.md" ], "title": "Post", "description": null, "updated": null, "date": null, "year": null, "month": null, "day": null, "taxonomies": {}, "extra": {}, "path": "/post/", "components": [ "post" ], "summary": null, "toc": [], "word_count": 3, "reading_time": 1, "assets": [], "draft": false, "lang": "en", "lower": null, "higher": null, "translations": [], "backlinks": [] } }

Child context: { "nth": 1 } 

bemyak avatar Aug 20 '22 16:08 bemyak

Nested shortcodes are not really supported so that's more a feature request than a bug report

Keats avatar Aug 21 '22 19:08 Keats

Duplicate of https://github.com/getzola/zola/issues/515

Keats avatar Jan 12 '23 22:01 Keats