Copying an existing site
Read this when the owner already has a site and asks you to bring it over:
match its look, but put its content where the owner can edit it in the
Vizitka app. building still applies to everything else.
A copy is done when it looks like the original and the owner can edit every article, case study and other repeated item in the Vizitka app. A pixel-perfect copy they can’t edit has failed, the same as an editable one that looks nothing like the original.
Anything the site repeats is a table
Section titled “Anything the site repeats is a table”Articles, case studies, projects, services, team members, testimonials and
prices are each a list of items with the same shape. Each kind is one table,
and each item is one row. Articles use the reserved posts table, so the owner
edits them in Posts. Case studies and projects use the reserved portfolio
table, so the owner edits them in Portfolio, with a cover, drafts and an
order of their own (vzk/tables, “Posts and Portfolio”). Every other kind gets a
table of its own (create_table), edited from its table screen.
- One item is one row. Its words, its long text and its pictures are the
row’s values, never a page of its own or text typed into a page, a layout
or a component. Long text goes in as Markdown (
vzk/tables, “Posts and Portfolio”). - Anything an item carries is a field on its table. A summary, a category,
a card picture, a price or a place in the order gets a field
(
update_tableadds one later), read asrecord.summaryon the table page anditem.summaryin a listing. Order by asortablefield withsortByrather than by where rows happen to sit. A portfolio already keeps asummary, acoverand aposition, and lists in the owner’s order when a page names none, so a case study’s metrics, client or year are the fields to add. - Each field is one the owner edits. One idea is one field holding a
value, so a category is one
choiceand a reading time anumber, and the words around them go in the site’s files (vzk/tables, “One idea, one field”). Leave the import’s bookkeeping behind, such as a title as it was imported or the old site’s id: once the copy is done, the owner has one title to edit. - One table page renders every row of a kind that has pages of its own,
reading
record. A component holds reusable presentation, never one item’s content. - Every listing reads the table. The home page, the listing page and any
other page that shows an item loop over
tables.<name>and read the same fields. A summary is written once, on the row, never retyped into another page’s fields. - A very long article is split into several posts, because a body has a
size ceiling (
vzk/tables).
Pages the owner can find their way around
Section titled “Pages the owner can find their way around”- Name every page field for what it holds and where it shows
(
cta,hours,links;vzk/pages, “Named fields”). A field named by a counter is editable but impossible to find. Words a page just says need no name: write them in the first language, and each other language’s catalog translates them (vzk/languages, “A text is its own key”). - A policy, terms or a long story is one Markdown field, not a field per
paragraph (
vzk/pages, “Dates and long text”).
Bring the tokens, not the built CSS
Section titled “Bring the tokens, not the built CSS”Copy the old site’s colours, fonts and spacing into @theme, and its
recurring pieces into component classes (vzk/styling). Never paste
its built stylesheet: a commit of it is refused, and the compiler
already makes every utility the pages use.
Then build the pages from those names and leave the old site’s numbers
behind. A value it uses twice is a token, and only a value one element alone
has stays arbitrary. Its media queries become a phone-first layout under
md: and lg:, never max-[Npx]: classes. A card’s colours stay out of
its row (vzk/styling, “A row holds content, not styling”).
Try the platform before a workaround
Section titled “Try the platform before a workaround”Draft the design with Markdown bodies and structured fields first. Reach for a
workaround only once a draft shows they cannot match it, and file that gap
with request_feature so the platform can close it.
Check before merging
Section titled “Check before merging”For each table you made, edit one row’s title, body and each other field
you added on its screen (or with update_record) and look at the preview:
the row’s page and every listing that shows it change, because all of them
read the row. A preview shows draft posts and portfolio items too. If any still shows the old
words, text was copied into a page, a layout or a component, and it has to
move into the row. Put the edits back afterwards.
Then read one post as the owner sees it in Posts (get_record), and one row
of each other table you made. Every field should be one the owner would
change, and each change should be made once. A field that repeats another,
holds words a file could say, or holds what the template could work out
should go: take it out of the pages, then remove it with update_table
(vzk/tables, “Writing a table on a branch”). Removing a field that
holds values waits for the owner’s approval, so tell them.
Once content has moved into a table, delete the pages and components that held it.