Apply Template to an Existing Object

Thanks @ignatovv!

This wouldn’t really address the issue for me, but I understand that retroactively applying a template is very difficult.

What about an option to “lock” an object to a specific template? So that relations, blocks, and layout in the object have to stay exactly as they are (or were) on the template they were created from. This "lock* could be toggled on a collection and/or type basis, and optionally disabled per object.

This looks like overly complicated thing for the current stage of the app.
But if you could share and apps with great ux of retroactively applying a template I would really appreciate it and take inspiration from :face_holding_back_tears:

Is it useful for some to apply to empty objects?
Not for me, unfortunately.

But yes, applying to modified objects can be more complex. But it’s essential if you want to take full advantage of templates.

But discussing it could help us find a solution that satisfies the majority?

In my opinion…
In parts managed by a :

  • title: indeed, if a title exists, it’s difficult to modify → do nothing
  • Featured relations: displaying or not displaying has no impact on the data, it’s a display → apply the template
  • page content… to be discussed! Difficult to modify existing content, you’d have to be able to “map” it to the template content. Very complicated! Why not simply add the template content to the top of existing objects?
    – to make things even better, we’d need to manage template modification: if part of the content of an existing template is modified/deleted/added, we’d need to be able to force application to existing objects using this template.
  • Layout (I think it’s managed too?): no problem to apply, I think.

Please, don’t close the point, it seems important enough to think about and find a solution.

PS : user case for apply modification of a template : a template with relation inserted in the page (to make them more readable than being featured). I add or modify one relation, and modify the templat to add (or delete or change) the relation inside the content.
To be able to pass on this change would be top-notch (a pop-up asking if we want to apply it everywhere?) and would only affect the part already managed by the model.
(and yes, changing the template would be complicated for the content, though. unfortunately).

Yep, we want to give an option to update relations without losing content or creating new object or updating relation manually.

Thanks @ignatovv for an update on this topic!

I think @Shampra has done a nice job on explaining some of the different parts, and what should hopefully be possible to update with a template - even though some content has been added.

And I agree that in the content section, I would love to be able to apply a template, even though some content has been added - just add it to the top of content (or a pop-up to select if I want to add content at top, bottom, or only update featured relations/layout…)

But to me, the more important part is also the ‘Update template’ after it has been applied to multiple/many objects.

Example: Movies. I might have inserted relations in the top of the content with Rating, Genre, Actors and stuff like that, and used that for a lot of movies. Now I decide I want the Year of production too. So I add that as a relation below the others in the template - then I really would like it to be added to all existing Objects using that template (optimally with a pop-up to select if I want to ‘Update all’ or ‘Just update template’ (for future objects)).

I get it, that there are quite some challenges in this, and really don’t expect you to find the perfect solution in a matter of weeks - but to hear that development is active in this area is very nice! Thanks!

I have always thought the problem with templates is less about the layout and more about the relations (properties). edit: I still appreciate what you’ve been doing with templates and consider it a needed change.

Wouldn’t it be better if you re-invent your “featured relations” instead?
So you could select the relations that are going to be shown in all of your objects with the current key: value format you already have. I’d say it can be like Obsidian where you have your frontmatter (featured relations at the top of the page, below the title; standard for all the object in the type) and inline-properties (normal relations, you put them wherever you want).

I mean as stated by @glennovits, the problem is that if you don’t deeply plan your templates (or types) ahead, you will have a terrible time adding something new because you will have to add that in every single of your objects one by one.

I also need this function, I forgot to add a relation preview to the template, and I have already created 1000 pages, idk what to do :smiley:

What do you mean by that?

It is the metadata (the relationships and how they are displayed) that should be uniform accross new and existing instances of the object. Adding new relationships, but also removing old ones. This is particularly usefull when migrating from Notion.

This is really, really sad news. Please find a way. This will make Anytype more consistent and multiple times more powerful. I know it is hard to implement it now at this stage of the app, but maybe you should consider reinventing that part of the system to make it more robust.

Hi @ZOa :pray: Could you help us make this happen - provide references in any other apps with expected behaviour. This will really elevate the quality of info we could provide about this feature.

I’m happy to see that the team is looking into this and involving the community into the thinking process !

The lack of this feature is currently one of the biggest pain points for me because it greatly hinders the following workflows:

  1. updating the layout of “structure-only” notes (notes whose only content is the display of relations)
  2. getting multiple notes into Anytype from another source
  3. switching between object types (important part of the Zettelkasten workflow where you start with the temporary notes and you switch later to the permanent ones)

The way I deal with it currently is simple but cumbersome and time-consuming: I go into the template, copy its content / structure, return to my object and paste it there.

I agree that finding a way to do a correct merging of the content of the template with the current content of the note might be tricky, and not only due implementation difficulty: there’s no one definition of “correct” merging as it will depend on the use-case.

But there are alternative approaches that I think would tick most of the boxes: easy to implement for the devs, would solve (or at least greatly smoothen) most use-cases and empower the users to choose the “correct” application of the template. A user could choose between the following:

  1. Replace the content of the object with that of the template (would be suitable for use-case 1 above as no content would actually be lost because it was all in the relations)
  2. Prepend or append the content of the template to that of the object (and then deleting / moving a few things around, which will be much smoother than the workaround mentioned above)
  3. Being able to define a {{ content }} placeholder inside the template. When it’s applied to an object, the content of the latter will replace the placeholder

After discussing with a future convert (hopefully), this point is really anticipated. And complicated. But anticipated! From the discussion, two things emerge:

  • This FR can be divided, with a simpler FR that allows us to start addressing a portion of the needs.
    This one would be to apply bulk addition/removal of relations and Featured Relations (for all objects with the template).
    Development-wise, I don’t see complications, it’s outside the modifiable parts of the objects (even if we add relations to only one of the objects, there’s no problem in removing the initial ones or adding new ones, and no problem marking them as featured).
    So direct display of modifications. And it addresses some requests mentioned above.

  • Applying the modifications to the page is more complicated as it can be altered in all directions!
    One (among other) possibility would be a form mode: the object can’t be modified outside the relationships! A sort of form, in a way. The template defines how it’s presented, adding editable “fields” through the insertion of relation. And there you go: if the template evolves, the modification of the template can be automatically applied to all objects with that template!"

from the dev point of view, you could even simply allow it only if no fields/properties/relations are clashing. Then one can investigate how much is automatic data transfer is really required or if at all. I bet most folks simply miss to get the missing relation definitions quickly into the already existing object without any needs of actually having data blocks transformed into different types.

I think @Shampra nails it on the head: Option to apply template to an existing object - #58 by Shampra

To me, the most important and urgent aspect of this is to bulk-update relations. This is basically the same as changing properties in a Notion database: add, remove, or edit a property in the database, and all of the pages in the database will get the update.

In Anytype, instead of applying to all objects in a Collection (the equivalent of applying to all pages in a Notion database), this process could be tied to entire types or specific templates: add, edit, or remove a relation in a template, and all of the objects that follow that template will see their relation updated. To implement this, the only change needed would be the ability to “attach” and “detach” objects from templates:

  • create an object from a template, and that object is automatically “attached” to that template: the object has all the relations from the template
  • update a template, and all attached objects will get the update
  • if you don’t want an object to follow a particular template anymore, simply “detach” it
  • any existing object that isn’t attached to a template can be attached to one: in this case, it will lose its existing relations and gained all of the templates’ relations.

It would be good if we could apply template to a different template object too; but together with attachment/detachment of template, it might require some sort of priority or prevention of infinite loop.

REAL LIFE USE CASE

If certain components are required across all object types and their templates, then by apply template to another template, users don’t need to repeat the whole process in the creation of every template.

Good for template modification too.

WHAT DO YOU RECOMMEND

Template syncing to objects within a set and/or mass relation apply to all objects in a category/set. Similarly to Notion, or how master pages work in Indesign.

HOW COULD IT BE DONE

Allow templates to be synced in all affected pages through the types interface.

REAL WORLD USE CASES

Very often users create a template and decide later that they need more relations added to it. This would enable this to be done quickly without having to manually go into each page and add or remove relations manually.

RECOMMENDED ALTERNATIVES

You could just do this automatically and allow users to disable it for individual pages. I think there’s more precedent for this way of doing things than how it is currently implemented. Most other programs like Figma and Indesign operate like this already.

Hi!

I’m new to AnyType, coming mainly from Notion. As many other people in this thread I quickly felt the need to maintain a template linked with a type after objects of that type were created already, and see the template changes applied. Having read the discussion, and thought about the differences between AnyType and notion, I wonder if the core need of 80% of people in this situation can be reframed in a way that allows for technically (and conceptually) easier solutions.

I think that what we often (though, granted, not always) will be looking for is a way to create/maintain a nice “properties view” to speak in Notion terms. That is, click on an object and see all its relevant relations (switching to Anytype talk now) in a readable and editable way. I believe the solution could be in layouts rather than templates. Today the few layout options allow at best to show a row of selected relations in the object detail view. But that’s not very readable or practical.

I’m using templates to create a structure with a mix of 1-column and 2-column relation lists. And foreseeably if I add a new relation later on, or forgot to include one in the template, already created objects won’t be aligned with the modified template. But if there was a layout called “relation details” (better name needed) which would show a Notion-like list of all the relations linked with the object type, based on the current definition of the type (i.e. the relations “linked” to that type if I’m correct), then my (80%) need would be fulfilled. And it fills like doing this would not bring the issues of re-synchronising templates with existing content. The object’s actual content would still be displayed after the list of linked relations. Ideally, this layout would be customisable at the object level so I can choose to omit one relation, to place those 2 together and those 4 on 2 columns, etc.; but that would be icing on the cake.

This may be irrelevant and already proposed somewhere else, if so please let me know and I’ll upvote that! Or let me know if this should become a separate topic.

Regards,
Pierric.

It is interesting to bring up layouts. The function of layout is definitely not actualised yet.

Different stored display for the same object can be very useful for prioritising information for input, viewing and revision.

Worth creating a new feature request or discussion for this. :+1:

Thank you for your reply. I have just opened this request, though I’m afraid my explanation is a bit unclear over there :thinking: