Export and Publishing
What happens when exporting to the publish/ folder, how pages, CSS, runtime files and extension contributions are produced, how preview and FTP upload work, which privacy rules apply and what authors can influence.
Overview#
Three paths lead from a project to a website:
| Path | Button | Target | Purpose |
|---|---|---|---|
| Export | “Export” | <project>/publish/ | finished, uploadable website |
| Preview | eye (live preview), “View in browser” | <program profile>/preview/<id>/site/ | viewing and testing, never in publish/ |
| Publish | “Publish” › “Upload to the server” | exports first, then uploads publish/ via FTP, FTPS or SFTP | getting the website onto the server |
The website is plain HTML and CSS, optionally with PHP pages. Running it needs neither the program nor a database of the program.
The publish/ folder#
The result of the export, shortened here for the example project from the chapter Packages (three pages, one image, one SVG):
publish/
index.html impressum.html kontakt.html
style.css
assets/images/foto.jpg assets/images/logo.svg
vendor/bootstrap.min.css
vendor/bootstrap.bundle.min.js
vendor/bootstrap-icons/…Depending on the content, these are added: vendor/vn-…/ (runtime scripts), assets/vn-…/ (server parts), assets/<extension>/ (contributions of extensions), assets/fonts/, assets/vn-shared/config.php, sitemap.xml, robots.txt, llms.txt, vn-translate/ and vn-blog/. The project folder also contains .publish-pages.json (list of the pages exported last); it stays outside publish/ and is not uploaded.
The export overwrites only what it creates itself. Other files in publish/ (for example a self-made .htaccess) stay in place and are uploaded along with the rest.
How the export works#
exportSite() in index.html calls buildExportSite() (src/publish.js) and passes the result to fs:savePublishHtml (main.cjs). Steps:
- Choose pages. The pages with a tick in the page list are exported (
publishis notfalse); the preview also includes the active page. Without a page or without a block, the export aborts with a message. The CSS of all pages still goes intostyle.css, even if only some pages are exported. - Render the blocks of each page and bake in all adjustments (Baking in).
- Assemble the page (Structure of a page).
- Bundle
style.css(Structure of style.css). - Write files: pages,
style.css, referenced files fromassets/, runtime files used fromvendor/, server parts, contributions of extensions, SEO files. - Clean up: pages and files of an earlier export that no longer belong are removed (File names, Assets).
Structure of a page#
Every page has this order (from buildExportHtml):
[Code „vor dem Dokumenttyp“ (Global + Seite) und PHP-Code mit data-position="top"]
<!doctype html>
<html lang="…">
<head>
meta charset, meta viewport, title
meta description, Open-Graph-/Twitter-Tags (nur mit Social-Bild und Website-Adresse)
SEO-Tags (Canonical, Robots, JSON-LD …; nur wenn eingeschaltet)
Favicon
vendor/bootstrap.min.css (außer im Bootstrap-Modus „aus dem Theme“), vendor/bootstrap-icons/bootstrap-icons.css
Stile der Zusatzfunktionen (Lightbox, Cookie-Hinweis, WhatsApp, Popup, CMS, Tooltip, Animationen)
style.css
Beitrag „head“ der Erweiterungen
Code „vor </head>“ (Global, dann Seite)
</head>
<body>
Code „nach <body>“
seitenweite Blöcke oben (Menü …), Blöcke der Seite, seitenweite Blöcke unten (Fußzeile …)
Nach-oben-Knopf und Anker-Versatz
Skripte: vendor/bootstrap.bundle.min.js (oder die Skripte des Themes)
Skripte der Zusatzfunktionen (nur wenn benutzt)
Beitrag „bodyEnd“ der Erweiterungen
Code „vor </body>“ (Global, dann Seite)
</body>
</html>The title is the SEO title of the page, otherwise the project name (for pages other than “Home” that have a page name: Project — Page). lang comes from the page or the website (default de; invalid values become de). The back-to-top button is on by default (website setting). The scripts of the additional functions (video, background video, animation, form, tooltip, submenu, translator) appear only on pages whose HTML needs them.
Baking in texts and adjustments#
Each block is rendered with its current values (schemaEntry.render). The export then works the user's adjustments into the HTML in exactly this order; editor traces (data-vn-text-id, contenteditable, vn-editable-text, data-vn-image-key, data-vn-drag…) disappear in the process:
- Video embeds and video attributes, PDF viewer addresses; editor placeholders (
data-vn-editor-only) are removed. - CMS: mark texts and images as editable (only blocks with CMS).
- Text size, text width, text position (the sliders in the panel).
- Menu item icons.
- Animations.
- Texts: entered content, chosen heading level, links, alignment.
- Buttons, icons (Bootstrap Icons and custom icons), free images, image links, alt texts, titles, sizes.
- With the cookie notice active: block third-party embeds (Privacy).
- Image optimization (below).
- Put free image layers into a container with
position: relative; put popup blocks into their window.
After that, all file:// addresses of the project become assets/…. PHP code from <script type="text/x-vn-php"> becomes raw PHP; if the script has data-position="top", it goes to the start of the file.
Structure of style.css#
All pages load the same file style.css (browser cache). The content, in this order:
- The theme CSS of all themes active in the project, unscoped and without
@layer. - The CSS of all blocks of all pages, for each block its compiled LESS output with the instance class in front. Site-wide blocks appear only once.
- The
@font-facerules of the custom fonts and the font and typography settings of the website. - The rules of the Free Area (
vn-fl-wrap), if a page needs it. - Fixed rules of the program: fixed menu at full width with
z-index: 5000, dialogs (.modal,.modal-backdrop) above the menu, darkening of menu items and coloured links on hover, expanded mobile menu (spacing at the bottom, scrollable by itself from 80 % of the window height), link style (underline in menu and block, program setting). - Last, the user's Custom CSS (“Custom CSS…”), so that it overrides everything.
The editor knows @layer and @scope, the finished page does not: there, with equal specificity, the order decides. All file:// addresses in the CSS become assets/….
Site-wide blocks in the export#
Site-wide blocks (attribute global, see Site-wide blocks) are kept in a separate list and appear on every exported page: blocks whose group contains menu, nav or header before the page content, all others after it. In the test, the menu stood before the hero and the footer after it.
Pages and file names#
- The file name of a page is
^[a-z0-9_-]+\.(html|php)$(lowercase letters, digits,_,-only); the user chooses the extension in the page list. Any other name makes the export fail with “Invalid file name”. - PHP in
.html: If a page contains PHP code (block “Custom PHP code”, CMS, blog, custom code in the Global HTML insertions) and is named.html, the program does not rename it. It only reports: “PHP only runs there if your server executes .html as PHP”. The user changes the file name to.php. - Pages that are not exported this time (unticked, renamed, deleted) are removed from
publish/again by the export, but only if they come from it (list.publish-pages.jsonand the markervendor/bootstrap-icons/bootstrap-icons.cssin the file). - The DEMO edition adds a note about VN-Designer to every page.
Images and assets#
Only files that the finished HTML or CSS refers to are copied: every string assets/… in the text of the pages and of style.css (ends at a quotation mark, parenthesis, space, &, <, >). A theme import that has put hundreds of demo images into assets/ therefore does not bloat publish/. In addition:
- Files over 20 MB (videos) are not copied again if the existing file has the same size and is not older.
- References that the export does not find in the text are copied explicitly:
assets/vn-shared/(always),assets/vn-formrender/forms/and the PDFs of the PDF viewers (fonts and images in the CSS are found by the normal search). - A previously exported image that nothing refers to any more is deleted from
publish/assets/(empty folders as well). The program deletes nothing on the server. - The theme CSS files under
assets/theme/and the scripts underassets/theme-js/are copied only if the pages refer to them (the theme CSS is insidestyle.css).
Image optimization#
The optimization is active only if the SEO tool (site.seo) is switched on and “Optimize images” applies. Then all images from the third one on a page get loading="lazy", all get decoding="async", and project images without a size get the attribute style="aspect-ratio:auto <width> / <height>" (the natural aspect ratio, so the page does not jump while loading). Deliberately without width/height, which could distort a layout. The program does not resize or convert files.
SEO output#
Everything here is off as long as the SEO tool sets nothing; existing pages then stay unchanged character for character. With settings, the head gets: canonical, robots meta (max-image-preview …), additional social tags, hreflang and JSON-LD (organization, local business, hotel …). The export also writes the files sitemap.xml, robots.txt and llms.txt (only these three names, only if switched on, at most 2 MB each). If one of them is switched off, the next export deletes the file created earlier, but only if it carries “Erzeugt von VN-Designer” in its first 400 characters. The Open Graph tags exist without the SEO tool if the page has a social image and the website has an absolute address.
Runtime files from vendor/#
The program copies only what the exported pages actually load. The trigger is a reference in the HTML of the pages:
Target in publish/ | Trigger |
|---|---|
vendor/bootstrap.min.css, vendor/bootstrap.bundle.min.js, vendor/jquery.min.js | reference in the HTML (jQuery only in the Bootstrap mode “from the theme”) |
vendor/bootstrap-icons/ | always |
vendor/vn-lightbox/, vn-cookie-consent/, vn-whatsapp/ | function switched on in the bar |
vendor/vn-tooltip/, vn-submenu/, vn-popup/, vn-sform/, vn-bgvideo/, vn-video/ | a block on a page needs it |
vendor/vn-cms/ (with generated config.php) | a block with CMS |
assets/vn-formrender/ (with forms/.htaccess, config.php, recipients.php) | class vn-formrender or vn-sform-form in the HTML |
assets/vn-search/ | class vn-search |
assets/vn-pdf-viewer/ together with the PDFs used | PDF viewer |
vn-translate/ (with vn-translate-config.php and .htaccess) | VN Translator active |
vn-blog/ | blog blocks |
recipients.php lists the recipient addresses of all data-recipient values of the forms (and, from version 1.3.100, of the addresses from native-form-handler.php?to=…); mailer.php and native-form-handler.php send only to these addresses (the handler additionally to its own sender address, see Recipients). The files under vendor/ in the program are part of the program, not of the project; authors cannot change them.
vn-shared and config.php#
Credentials are never in the project folder but in the program profile. Only at export are the PHP configuration files created in publish/: assets/vn-shared/config.php with the SMTP values and a hmac_secret if SMTP access is entered (in the preview with mail catcher values). Variables: $smtp_host, $smtp_port, $smtp_encryption, $smtp_username, $smtp_password, $smtp_from_email, $smtp_from_name, $hmac_secret. PHP parts (forms, extensions) read them with include from assets/vn-shared/config.php. Other generated files: assets/vn-formrender/config.php (hCaptcha secret), assets/vn-search/admin-config.php, vendor/vn-cms/config.php (salted hash of the CMS password) and vn-translate/vn-translate-config.php. All values are sanitized and written as PHP strings.
Contributions of extensions#
Contributions (Extensions) are output only while the extension is loaded. The export writes files[].text to publish/assets/<id>/… (only paths of this form, at most 600 files in total, 400000 characters each), replaces {{secret:NAME}} and {{secret-php:NAME}} and removes previously written files that no longer belong (together with folders that have become empty). head and bodyEnd appear on every exported page.
.htaccess#
The program creates .htaccess files in only two places: assets/vn-formrender/forms/ (Options -Indexes) and vn-translate/ (blocks the configuration file with the key). All other protection files are created by the server parts themselves (for example the extension VN iCal on first access for data/) or by the author. A self-made .htaccess in publish/ (or in assets/<extension>/ as a file of the contribution) is kept by the export and uploaded as well; in the test, publish/.htaccess stayed in place after another export. The preview server never serves files that begin with a dot.
Preview and export#
The preview calls the same export function with preview: true, but writes to <program profile>/preview/<hash of the project path>/site/. As a result, nothing that PHP writes during testing (databases, sign-ups, logs) ends up in the folder that “Publish” uploads, and the preview never overwrites publish/. Differences from the export:
- The page runs through a local server (only
127.0.0.1, random port, the Host header must match exactly, foreign web pages may only read)..phppages run if aphp.exeis known (setting, add-on program “VN-Local Server” or installation from the program); otherwise a notice page is shown instead of code. - Mails from forms and extensions do not go out but land as
.emlfiles in a mail catcher folder. - Memo lists for contributions and assets are kept separate for the preview.
- The live preview loads
http://127.0.0.1:<port>/<page>?v=<time>in a frame; scripts run there as on the real page, unlike in the canvas.
Publishing via FTP#
“Upload to the server” exports first (like “Export”) and then transfers publish/.
| Protocol | Note |
|---|---|
ftp | unencrypted, port 21 |
ftps | encrypted, port 21 (explicit) or 990 (implicit) |
ftps-lax | like ftps, without checking the certificate |
sftp | via SSH, port 22, username and password only |
- Only changed files: The program forms a SHA-256 value of every file in
publish/and compares it with the state of the last upload to this target (marker by project, protocol, server, port and target folder, in the program profile). A different target (test server, then live server) therefore always starts with a full upload. Without the switch, it uploads everything. - FTP/FTPS: File by file; if the connection drops, the program reconnects (up to five attempts) and continues there; every finished file is saved in the marker. Login errors and final refusals by the server (5xx) are reported immediately. Target folders are created.
- Nothing is deleted on the server. Files that were removed locally also stay there; the user cleans them up.
- Credentials are stored encrypted in the program profile (named servers with a selection list), never in the project.
Privacy#
The finished website should load nothing from third parties unless the author explicitly wants it.
- Bootstrap, Bootstrap Icons, all runtime scripts and all fonts are in
publish/itself. The program downloads Google Fonts when a font is set up and saves them in the project; the finished page never contacts Google. - Custom extensions and blocks must not load scripts, fonts, styles or images from foreign servers in
head,bodyEndor their markup. - The export blocks known third-party embeds when VN Cookie Consent is active: iframes from Google Maps, YouTube (also youtube-nocookie) and, from version 1.3.100, Vimeo (
player.vimeo.com/video/…) and scripts from Google Tag Manager, Google Analytics, Facebook. The iframe losessrc(it becomesdata-vn-cc-src), the script becomestype="text/plain"; an overlay button loads the content after consent. Categories: maps “functional”, YouTube and Vimeo “marketing”, statistics scripts “statistics”. With the attributedata-vn-consent-category="functional|statistics|marketing"on theiframeorscript, you block any other source as well. - If VN Cookie Consent is not active and the pages contain such embeds, the export reports a warning (“may violate the GDPR”). It exports anyway.
- The Map element of the block builder (
google.com/maps) and the Video element with a YouTube or (from version 1.3.100) Vimeo address are blocked when the cookie notice is active. Background videos from YouTube and Vimeo (data-bg-video) are only created at runtime byvendor/vn-bgvideo; with the cookie notice switched on, it loads them from version 1.3.100 only after consent to "Marketing" (until then the fallback image stays in place), without a cookie notice immediately (Playback on the page). Blocks with their own embeds from other providers should state the category themselves. - The code of the Global HTML insertions (raw text) also passes through the block for known services when the cookie notice is active. The contribution (
head,bodyEnd) of an extension is not blocked: extensions therefore never load third-party content.
What authors can influence#
| Place | Effect | Description |
|---|---|---|
| Custom CSS | at the very end of style.css | website-wide CSS of the user |
| Global HTML insertions | <head>, after <body>, before </body>, before the doctype | website-wide; page settings have the same four fields per page; raw text, inserted unchanged (PHP allowed, the page must then be named .php) |
| Block scripts | <script> in the markup of the block | run on the finished page; in the editor with stand-ins. Blocks that insert elements via script belong in markup with {{vn-id}}; markers as a JavaScript property |
| PHP blocks | block “Custom PHP code”, custom-php | end up as raw PHP at the position of the block, with data-position="top" at the start of the file |
| Export contribution of an extension | head, bodyEnd, assets/<id>/… | see Extensions |
| Anchor ID | id on the root element | property of the block; otherwise blk-<id> |
| Page settings | title, description, social image, lang, custom code | per page |
| SEO tool | canonical, sitemap, robots.txt, JSON-LD, image optimization | see SEO output |
| Cookie attribute | data-vn-consent-category | blocking of your own embeds |
| Site-wide blocks | global/once on the root element | position of the blocks in the export, see Site-wide blocks |