Skip to content

Support page-scoped assets without forcing route changes #13

@tormnator

Description

@tormnator

Is your feature request or improvement related to a problem?

Nue's asset loading is currently directory-scoped, which works well for shared area assets, but it makes a common parent-page and child-pages structure awkward.

Example:

  • /blog/ has CSS shared by the blog area
  • /blog/ also has CSS that should be private to the blog home page
  • /blog/posts/* has CSS private to post pages

Today, the blog-home-private CSS tends to flow into descendant pages unless the user reaches for include/exclude, manual <link> tags, or changes the route shape.

Users should not have to change URLs or folder structure just to get page-private assets.

Solution you'd like

A first-class way to scope assets to a single page while preserving clean file-based routes.

The most intuitive option to me is companion page files. For example:

  • index.md + index.css
  • about.html + about.css

That feels natural, easy to teach, and friendly to rapid development.

Alternatives you've considered

  • Generalize the special home/ idea to nested apps, possibly with a name like @home so it does not collide with a literal home/ route segment.
  • Add an explicit opt-in config in app.yaml, for example under design, to mark certain files as page-scoped.
  • Keep relying on include/exclude or manual head links, but those feel more like workarounds than a first-class solution.

Additional context

I am not attached to one exact implementation. The main goal is to support a very common pattern:

  • shared assets for a parent area
  • private assets for the parent page
  • private assets for child pages

without forcing different URLs or extra routing ceremony.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions