kraenkvisuell / kraenk-statamic-reps
Shared backend for kraenkvisuell's artist representation sites (Statamic 6): content model, SEO, legacy Nova import and re-sync, Bunny storage.
Package info
github.com/kraenkvisuell/kraenk-statamic-reps
Type:statamic-addon
pkg:composer/kraenkvisuell/kraenk-statamic-reps
Requires
- php: ^8.3
- barryvdh/laravel-dompdf: ^3.1
- daun/statamic-multisite-field: ^1.3
- kraenkvisuell/statamic-bunny-assets: ^0.2.3
- league/flysystem-aws-s3-v3: ^3.0
- statamic/cms: ^6.0
- statamic/eloquent-driver: ^5.12
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v0.2.21
- v0.2.20
- v0.2.19
- v0.2.18
- v0.2.17
- v0.2.16
- v0.2.15
- v0.2.14
- v0.2.13
- v0.2.12
- v0.2.11
- v0.2.10
- v0.2.9
- v0.2.8
- v0.2.7
- v0.2.6
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.46
- v0.1.45
- v0.1.44
- v0.1.43
- v0.1.42
- v0.1.41
- v0.1.40
- v0.1.39
- v0.1.38
- v0.1.37
- v0.1.36
- v0.1.35
- v0.1.34
- v0.1.33
- v0.1.32
- v0.1.31
- v0.1.30
- v0.1.29
- v0.1.28
- v0.1.27
- v0.1.26
- v0.1.25
- v0.1.24
- v0.1.23
- v0.1.22
- v0.1.21
- v0.1.20
- v0.1.19
- v0.1.18
- v0.1.17
- v0.1.16
- v0.1.15
- v0.1.14
- v0.1.13
- v0.1.12
- v0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
This package is auto-updated.
Last update: 2026-12-03 16:03:42 UTC
README
Statamic 6 addon with the backend shared by kraenkvisuell's artist representation sites
(kombinatrotweiss, wildfoxrunning, visualeyes, aiartists), which replaced their Laravel Nova 3 sites.
Frontends (Antlers, CSS, JS) stay in each site; this package holds the content model, the import and
re-sync from the old Nova sites, SEO, the lightbox and the portfolio queries. Everything a site does
differently is set in its config/kraenk-statamic-reps.php, which is merged over
config/kraenk-statamic-reps.php (every key has a default there;
associative arrays merge recursively, lists replace).
Slideshows field of the artist
The artist's slideshows field is a reps_slideshows field (an entries field, Fieldtypes\Slideshows)
with rows like the old Nova list: a position dropdown (plus drag), the categories under the title,
the works' thumbnails (cp.slideshow_thumbnails, videos play muted), the number of works (opens the
slideshow in a stack) and actions: edit, publish/unpublish, hide in / show in the artist overview
(feature overview), delete (with a confirmation modal, for users who may delete slideshows; the
slideshow is deleted right away and leaves the artist's list); no unlink, a slideshow always belongs to its artist (only a slideshow that no longer exists can be unlinked). Instead of Statamic's
"Create"/"Link" buttons it has an "Add slideshow" button (the labels.slideshow label) on the right
above the list (adds the new slideshow at position 1) and below it (adds it at the end); new
slideshows start as drafts (default_status: draft, written by reps:install). The actions save the slideshow right away
(Http\Controllers\Cp\SlideshowItemController); the order is saved with the artist. The row is
reps-slideshow-item in resources/js/cp.js, which extends Statamic's own relationship row.
Slideshows tab of a category
With the feature category_slideshow_order (off by default; on at kombinatrotweiss) a category has a
"Slideshows" tab after the main tab, like the old Nova list: the slideshows its page shows (with
represents_in_categories only those with a work chosen to represent the artist in the category,
like Nova's category_slideshows_are_filtered), titled "Artist / Slideshow", with the artist's rows
but only the works the category page shows as thumbnails, no badges and only "Edit" as action.
Only the order is edited there (no link, create or unlink: a slideshow's categories are set in the
slideshow); it's saved as the category's slideshow_order, which Portfolio::categorySlideshows
follows (the others newest first). Fieldtypes\CategorySlideshows, reps_category_slideshows-fieldtype
in resources/js/cp.js.
Works of a slideshow
The collapsed work rows show what the old Nova list showed: the file as a large preview (videos
play), a badge per flag or category that is set ("Übersicht", "Portfolio-Bild",
"Übersicht: Portrait", "Kategorieseite: Portrait"), then the title. The on/off flags (show in overview, portfolio
image, start page image, discipline image – whichever the site uses) are switches (one per line,
label to the right) on top of the
expanded row, saved with the slideshow. Listeners\AdjustBlueprints::workRows moves and marks the
fields (reps_large_preview, reps_flag, replicator_preview: false for the rest);
resources/js/cp.js extends Statamic's assets, toggle and entries fieldtypes only for marked fields.
"Add images" below the works (add_works, Fieldtypes\AddWorks) is an assets field for several
files at once (upload, drop or choose from the container): each file becomes an "Image / video"
work with the set's defaults, appended collapsed to the end of the works right away, in the order
the uploads finish (one at a time, in the order chosen). The field itself saves nothing. Config:
works_field (default works), set (default image) and the assets field's own (container,
folder). Statamic's replicator only reads its collapsed rows once, so cp.js lets every
replicator follow meta.collapsed when it changes from outside.
Translations (multi-site)
On a multi-site site (kombinatrotweiss) every language is edited in the default site's form; the
"Working in" panel and the site dropdown of the globals are hidden, and the edit page of a
localization opens its origin (feature translatable_fields, on by default, no effect on single-site
sites). Built on daun/statamic-multisite-field:
- every
localizable: truefield of the addon's blueprints (and of<blueprint>_extrafieldsets) becomes areps_translatablefield: one input per language behind a "Language" switch (in the sidebar, on global sets on top of each tab); untranslated values show the German text greyed out, titleandslugstay plain fields (Statamic needs them as strings), followed by "Title (English)" / "Slug (English)" (reps_site_value; empty: like German).
The data stays where Statamic keeps it: the German value on the origin, the English one on the
localization (the fields stay localizable, the eloquent driver stores only those as a
localization's own values). So templates, routing, SEO and reps:import / reps:resync are
unchanged. Translations\Listener writes the other languages to the localizations when the origin
is saved from the CP (an emptied field falls back to German); saves without these values (the
import) pass untouched.
Position column in CP listings
Collections listed in cp.position_columns (orderable ones, e.g. ['artists', 'categories']) get a
position select as the first column of their CP listing (Cp\PositionColumn, a computed
reps_position field added to the blueprint, the index component in resources/js/cp.js).
Picking a position moves the entry there right away (POST cp/reps/position/{id}, needs the
"reorder" permission) and reloads the listing. The order is saved through the collection's
tree like a drag in the CP, so static caching invalidates as for any reorder.
New entries of the orderable collections in cp.new_entries_first (e.g. ['news']) start at
position 1 instead of last (Listeners\NewEntriesFirst, on EntryCreated; quiet saves of the
import and re-syncs keep their order).
Simple translations (one site, kombinatrotweiss)
With bastihilger/simple-statamic-translations
installed, a single site and the feature simple_translations on, every language lives in the same
entry instead of a site per language (Translations\SimpleTranslations):
- every localizable field of the addon's blueprints (and of
<blueprint>_extrafieldsets) is wrapped in a translated field of its own handle, so templates read it as before ({{ description }}is the current language's);titleandslugstay plain and gettitle_translation/slug_translation;robotsstays plain (the same in every language), - the language comes from the URL (
/de/…,/en/…,{language}at the start of every collection route), - PHP that reads values raw uses
SimpleTranslations::read($item, $key)(the SEO tag, menu labels), language links and hreflangSimpleTranslations::urls($entry), reps:import/reps:resyncwrite the other languages into the translated fields (SimpleTranslations::merge: other languages only where they differ, idempotent) instead of localizations;legacy.localesmaps the legacy locales to language codes (['de' => 'default', 'en' => 'en']),seo.localesthe og:locale per language.
Install in a site
composer require kraenkvisuell/kraenk-statamic-reps:^0.1 (from Packagist). For working
on the addon next to a site, point it at a path repository (../kraenk-statamic-reps, symlinked) locally
without committing that.
Releases
Versions are git tags (v0.1.0, …). Under 1.0 a minor bump (v0.2.0) means sites need changes, a
patch (v0.1.1) is a fix. Release: commit, run the sites' tests against the change, git tag -a v0.x.y -m v0.x.y && git push --follow-tags; then per site composer update kraenkvisuell/kraenk-statamic-reps
(widen the constraint for a minor bump), test, commit composer.lock.
Then: php artisan vendor:publish --tag=kraenk-statamic-reps-config, set the site's options,
php artisan reps:install (writes collections, globals, navigations, the asset container),
php artisan migrate, php artisan reps:import.
What it provides
- Content model. Collections
pages,artists,slideshows(works as replicator rows),categories,disciplines, optionalnews,productions,special_categories+special_projects,projects+skills,clients; orderable (a tree) except those inunordered_collections(e.g.['pages'], left without a structure). Blueprints live inresources/collection-blueprints/and are registered as namespaces, so they are not copied into the sites;Listeners\AdjustBlueprintsinlines the addon fieldsets (reps::seo,reps::main_content,reps::work_common…), removes fields whosereps_featureis off and blocks not inpage_blocks, applies the labels and appends the site's own<blueprint>_extrafieldset. A site can still override a blueprint inresources/blueprints/vendor/collections/<handle>/. Global blueprints (site_settings,seo) are fallbacks. Computed values for routes:artist_slug(slideshows),special_category_slug,discipline_slug(artists),route_segment(categories).Listeners\SyncRelationskeeps both sides of artistslideshows↔ slideshowartist(special categoryprojects↔ special projectspecial_category): saving the parent sets the children's field; "Add slideshow" opens the create form with the artist filled in, and the saved slideshow joins the artist's list even when the artist form isn't saved; an artist's list always holds exactly the slideshows pointing at it (a form opened before a slideshow was added can't drop it; a slideshow given another artist moves). The artist is hidden in the stacks an artist opens and a select on the collection's own pages (AdjustBlueprints::artistSelect).Listeners\RemoveDeletedChildrentakes a deleted slideshow / special project off the list (Statamic doesn't remove entry references; the CP showed "This item is unavailable"), andListeners\LogDeletionslogs every deleted entry with the user.cp.nested_collections(e.g.['slideshows']) leaves collections edited inside their parent out of the CP nav, likespecial_projects. Classes insrc/Listenersregister themselves. reps:installwrites the structure files the config describes, touching only the keys it manages. Repeatable.reps:importimports the old Nova site from its dump on thelegacyconnection (LEGACY_DB_*). Nova is the source until go-live: imported entries (found bylegacy_id, ids are deterministic) are made to match the dump, rows deleted in Nova are deleted, entries created in Statamic are never touched. Rich text → Bard, nova-cms blocks →main_contentsets, settings → globals (legacy.settings, incl. grids), menus → navigations, multi-locale → localizations.legacy.robots => falseimports everything as indexed and followed, for old themes that wroteindex, followwhatever the robots checkboxes said (the new site respects them). A second run reports nothing to do. Options--only=,--no-media,--keep-deleted,--dry-run. Links in content that are an entry's URL (this site's orlegacy.url's, compared without case and accents, as the old texts use the old mixed-case slugs) become entry links (Support\EntryLinks); on a first import into an empty database, links to entries imported later convert on the next run.reps:fix-entry-linksdoes the same for rich text that is already there: every Bard link that is a plain URL of an entry becomesstatamic://entry::<id>(keeping?query/#fragment), and mixed-case or accented URLs that aren't an entry are listed. Run it once after updating to this version. Options--collection=,--dry-run. Repeatable.- Media. An asset's path is the old media folder + file name, so it never changes between runs.
The local
assetsdisk (public/assets) mirrors the old originals the content uses (rsync with--files-fromfrom the server, an S3 disk or a public URL); with the container on Bunny only new and replaced files are uploaded, and only replaced files lose their Glide images. reps:resyncdumps the live Nova database again (read-only, ssh), reports the differences, and with--applybacks up the content tables, imports and syncs media incrementally, then renders only the pages of changed entries.--restore=<backup>undoes an apply.- SEO (instead of SEO Pro): the Nova SEO tab as
reps::seoon every routable blueprint, aseoglobal for the home page and listing pages (seo.index_pages),{{ reps:seo }}for the head (title, description, keywords, robots, canonical, hreflang, og/twitter with configurable og:image fallbacks),/sitemap.xml. - Routes:
/sitemap.xml, slideshow URLs with a trailing slide number, 301s from old id URLs (legacy.id_redirects), the lightbox endpoints under/!/reps/lightbox. On multi-site installs a 404 that is an entry's URL in another site (/en/<german slug>) redirects to the entry in the requested site (localized_slug_redirects). - German CP. Blueprint labels, instructions, options, collection/global/navigation titles are
written in English and translated in
lang/de.json(the CP passes them through__()). A site gets a German CP withAPP_LOCALE=de(default in itsconfig/app.php) and can override single strings in its ownlang/de.json. Keeplang/de.jsoncomplete when adding fields. - Lightbox: a per-visitor list of works in the session, sortable per artist, as PDF (dompdf, view from the site).
- Portfolio queries (
Portfolio,{{ reps:works }},{{ reps:artist_categories }},{{ reps:category_artists }},{{ reps:overview }},{{ reps:slideshows }},{{ reps:rows }}). - Storage: the
bunny-assets,bunny-glide-cache,assetsandlegacy-mediadisks (fromBUNNY_*/LEGACY_S3_*) unless the site defines them;reps:copy-assets-to-bunny,reps:warm-glide,reps:refresh-uris. The Bunny disks use thebunnydriver from statamic-bunny-assets: S3 with failed reads retried (disk keysretries/retry_delay), because Bunny's replicas are sometimes out of step and answer 404 or an error for files that exist. - CP artist list like the old Nova index (
Cp\ArtistListing, computedreps_*fields in the artist blueprint that only appear in the list): the name with/slugunderneath (title and slug columns hidden by default), "Copy Link" / "Copy Link 2" buttons copyinga:<Nova id>/b:<Nova id>(featureartist_copy_links), portfolio images (cp.artist_portfolio_images, labellabels.portfolio_images), start page images (featurestartpage_images), disciplines, the colour as swatch and hex code (featureartist_bgcolor). Disciplines have a colour field only with the featurediscipline_bgcolor. The CP page list shows the page colour the same way (featurepage_bgcolor,Cp\ColorColumn), the news list too (featurework_bgcolor). - Slideshow of a news item (
Fieldtypes\ArtistSlideshows): the select only offers the slideshows of the artist chosen above it (none without an artist; Statamic's own select loaded every slideshow in one request, ~2,000 on wfr). Changing or clearing the artist clears the slideshow and reloads the options; both are clearable. - Entry order without a save per entry (
Entries\EloquentEntryRepository, eloquent driver): when a structure changes (a new news item goes first, an entry is deleted or moved) the driver queued a job per moved entry that saved it again (~2,200 jobs for one news item on wfr, 50 s with a sync queue). The order is written straight into theordercolumn instead; only entries whose parent changed are still saved. - News from a slideshow (feature
news_from_project, wfr,Fieldtypes\CreateNews): a saved slideshow has a "Create news item" button in its sidebar that opens the news form in a stack with the artist and the slideshow filled in. Not shown while the slideshow is being created. - Generated news titles (feature
news_headline, wfr): the text on a news item is itsheadline(the old title); the title is "Artist / Project" (Support\NewsTitle: the project's artist when the item has none, else the headline or subtitle, else "News"), via the collection'stitle_format: '{reps_title}'(written byreps:install) and the computedreps_title, hidden in the form. The import writes the same title, and the slug from it (old id appended only where two items share one); an empty slug in the CP follows the title, with -2, -3 … (Listeners\NewsSlug). Opt-in like the old Nova sites that had it:cp.artist_portfolio_images_fallbackfills empty slots with works shown in overviews, then the first works;cp.artist_portfolio_images_legacy_orderlooks for them in the slideshows by Nova id;cp.listing_videosplays videos in the image columns instead of a file icon (reps_listing_assetsfieldtype). HTML cells use thereps_htmlfieldtype, whose index component is inresources/js/cp.js(plain JS, no build; published topublic/vendor/kraenk-statamic-repsbystatamic:installascp.<content hash>.js, likecp.css: Bunny pull zones ignore query strings, so Statamic'scp.js?v=<version>was served the previous release's file, and browsers kept it for its max-age). - Asset metadata cache: every image a page renders needs its asset's metadata (
.meta/*.yamlon Bunny); uncached that's one Bunny request per image, minutes for an artist page. Sites give it a cache store of its own (asset_metainconfig/cache.php), whichcache:clear– run by composer'sstatamic:installon every install – leaves alone. statamic-bunny-assets'sbunny-assets:warm-asset-metaloads all metadata in parallel (about 5 minutes for 15,000 assets; seconds when everything is cached), in the deploy script beforereps:warm. Metadata edited in another environment (the bucket is shared) stays cached untilphp artisan cache:clear asset_meta. - Re-caching the site:
reps:warm [--queue] [--insecure] [--dry-run]clears the static cache and warms the pages in the order visitors reach them: the home page(s), every internal link in the home page's<nav>elements (the menu, whatever builds it), the home page's other internal links (news, teasers), the published artists, categories and special projects, then every published project of every published artist (artists by name, projects in the artist's order). A URL is warmed once, in the first tier that lists it, so a tier whose pages are all in the menu shows 0 URLs. Every language (simple translations) or site. Everything else is cached on its first visit. Deploys run it, and so should a site's invalidator wherever a save changes every page (menus, globals …). Queued, Horizon renders the pages in that order. With--queueit first clears its queue (static_caching.warm_queue, give it a queue of its own, e.g.warm) and releases the unique locks of the jobs it drops (queue:clearleaves them behind; the new run's jobs for the same URLs would be dropped silently). - Own queue and job: with
static_caching.warm_queueset (e.g.warm),reps:warmqueues there, with its own job (DeployWarmJob, so a waiting run doesn't swallow a save's re-cache of the same URL), and Statamic'swarm_queue(e.g.recache) only carries the re-caching of single pages after saves. Let Horizon take the queues in order without balancing ('queue' => ['recache', 'default', 'warm'],'balance' => false). - Warm requests through the CDN: the reps sites cache their pages at the Bunny pull zone
(statamic-bunny-cache's
bunnystrategy), and only a request through it fills that cache, so every warm request goes to the domain. Bunny gives up on a slow first render (a 504 after its origin timeout) while PHP finishes it; the warm job tries again a minute later, up to 3 times. (static_caching.warm_ip/REPS_WARM_IP, which sent warm requests past the CDN, is gone since v0.2.6: with thebunnystrategy the pages warmed that way never reached the cache.) - Bunny purges: with
static_caching.bunny(BUNNY_API_KEY,BUNNY_PULL_ZONE_ID) the pull zone in front of the site follows the static cache: every URL a warm job has just rendered and every invalidated URL is purged, the whole zone when the static cache is cleared (reps:warm,static:clear). Otherwise Bunny keeps its copy until it expires, and saves don't reach visitors. Off with thebunnystrategy of statamic-bunny-cache (the pull zone is the static cache and that addon purges pages by tag). - Special projects only inside their category: the
special_projectscollection is removed from Collections in the CP nav; its entries are edited through the special category's projects field. - From statamic-bunny-assets (required
by this addon, which only registers the disks with its
bunnydriver): CP thumbnails from the Glide CDN, original GIFs, uploads that don't drop each other's files from the asset listing, the asset meta warmer (bunny-assets:warm-asset-meta). Switched in that addon's own config (statamic-bunny-assets.cdn_thumbnails,.original_gifs); reps has no settings of its own for them (since v0.2.0;cp.cdn_thumbnails,imaging.original_gifsandreps:warm-asset-metaare gone). - Warm job with an expiring lock: the addon sets
static_caching.warm_job(when the site leaves it empty) toStaticCaching\WarmJob, Statamic's job with a one-hour unique lock. Statamic's lock never expires: a warm job removed from the queue without running blocked its URL for good.
License
MIT, see LICENSE.