How do i programatically change the type of the text field?

I have an article.yml which displays the text from the articles which i have imported from a wordpress website. The problem is that only the textarea shows the articles with the corresponding formatting and if i, for example, use the writer field and modify an article, all formatting is lost. Is there a way to programatically change the blueprint based on the date of the article? (all new articles to have a writer/blocks field and old articles to have a textarea field)

**I have tried to encapsulate the textarea inside blocks with custom block types and it works but it has a weird behaviour that doesn’t allow special chars to be displayed. (ăîâșț being displayed as &circ in the textarea) ← this seems the best option by far but I think it is a kirby formatting bug.

**I have also looked at the documentation (programatically generating blueprints) but I cannot find a way to get the date from each separate article and return the blueprint with the appropriate logic.

    label: Draft
    text: The article is still in draft mode. It can only be seen by editors with panel access.
    label: In Review
    text: The article is online and can be visited with the direct URL. The team must still give the final go to publish it.
    label: Published
    text: The article is online and listed in the blog

    width: 2/3
        type: textarea // blocks (based on the new articles that will be created and the old ones which are in the /blog directory)

I think it would make more sense to have two blueprints, one for the old articles and one for the new. Then in your pages section, show both templates, but use the create option to allow creating only pages with the new blueprint.

Hello, thank you for your response. Can’t i have a blueprint that fits all articles until now, and from now on only create articles upon the new one?

How is that different from what I suggested?

I am trying to wrap my head around how to do this. I am new to this :)) Can you guide me through the process or provide me with some documentation? How do i manage to display all the articles with the article.old.yml template and create new ones with the template?

Could i create a plugin like in the Programmable blueprints | Kirby CMS but adapt it to the article date instead of the user?

Create a blueprint article-old.yml for your imported articles, rename existing txt files of already imported articles to article-old.txt.
Create another blueprint article.yml for all articles that will be created in Kirby.

In the parent blueprint (blog.yml or whatever you call it), create a pages section like this:

title: Blog
# other settings

    type: pages
    headline: My super duper articles
    templates: # this makes sure that both old and new articles are shown in this section
      - article-old
      - article
    create: article # this makes sure that new articles can only be created with the article blueprint
    # other section settings...
1 Like

Thank you very much for your help!! Saved me a lot of hours :sweat_smile: