caolan / caolan/magery

Terminology: pages vs. components

Open
#25 3 comments 0 reactions 0 assignees View on GitHub
discussion
Dominant language
JavaScript
Stars
56
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Magery is designed around custom HTML5 template tags that called 'components' (though sometimes confusingly referred to as templates in our docs). On the server-side these need to be placed into a full HTML document to be useful, on the client-side only the components are used.

I'm proposing we call all current templates using custom tags 'components', and we introduce a concept of 'pages' for use with server-side implementations.

A page might look something like this:

```html


{{ page.title }}


Profile



```

Which makes use of a component defined like this:

```html

Hello, {{ user.name }}!

```

In the server-side library you would call separate functions/methods/whatever to load components and pages, for example:

```python
magery.load_components("./templates/components")
magery.load_pages("./templates/pages")
```

Components would be rendered using their tag name:

```python
magery.render_component("my-component", data)
```

And pages would be rendered using the path to the template file:

```python
magery.render_page("project/example.html", data)
```

Exactly how those server-side APIs look and how page paths are constructed will be up to server-side implementors - they can do whatever makes sense in their language.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing template terminology and the server-side implementation, then compare current behavior with the proposed components/pages split. Check how component loading and rendering are currently exposed, and how a server-side implementation could handle page loading and rendering. Done means the terminology and API shape are agreed for the relevant implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
backend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.