Code Export#

You can download the source code of any project to host it on your own servers. The process takes three steps:

  1. download the source code,
  2. upload it to a remove server,
  3. configure the server.

Please, note that projects will not work without the third step — if you simply upload them without configuring the server.

  • Typekit fonts will not work if you open a project from a file on your device. 
  • Readymag Form widget can only send data to a custom URL. Google Docs, Email and Mailchimp options will not work in exported projects.
  • Custom OG tags and SEO tags are not exported for any page except the first one (meta tags stored in index.html).
  • Exported projects cannot be changed. The content is encoded in JSON format and rendered on a page via javascript. If you need to make changes, find the project in your account, make changes, republish and export again.

Step 1: download the source code

To get project’s source code you need to publish it first. The download link appears in the settings. Specify the domain where the project will be hosted in the dialog box. This is necessary for third-party integrations to work (like Typekit webfonts).

Step 2: upload the archive to a remote server

In the downloaded archive you’ll find the following files and folders:

File Description
robots.txt pre-defined settings for web crawlers
build  stylesheets, templates and scripts
img  all images used in the project
snippets  static contents of all pages for search crawlers
index.html  project page, contains the content of the project encoded in JSON format
sitemap.xml  list of available links for search crawlers
sorry.html  custom page for unsupported browsers
nginx_rmwebsite.conf  sample configuration file for NGINX servers 
.htaccess  sample configuration file for Apache servers 

Folders, containing project assets (build, img, snippets), and index.html are required. Other files can be omitted if you don’t need them.

Step 3: configure your server

We provide sample configuration settings for NGINX and Apache servers.

server { listen 80; server_name nightcities.readymag.com; # Change path to folder with downloaded source root "/path/to/project_folder"; index index.html; access_log off; autoindex off; charset utf-8; location / { if (-f $request_filename ) { break; } if ($args ~ "_escaped_fragment_") { rewrite ^/([.a-zA-Z0-9-]+)/? /snippets/$1.html last; rewrite ^/ /snippets/1.html last; } location = / { if ($args ~ "_escaped_fragment_") { rewrite ^/ /snippets/1.html last; } } rewrite ^/?$ /index.html last; rewrite ^/[.a-zA-Z0-9-]+(/(.*))? /$2 last; try_files $uri $uri/; } } Options FollowSymLinks SymLinksIfOwnerMatch AddDefaultCharset utf-8 AddType application/vnd.ms-fontobject eot AddType font/opentype otf AddType font/truetype ttf AddType application/font-woff woff AddType video/webm webm RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} _escaped_fragment_ RewriteCond %{REQUEST_URI} !^/(build|img|snippets|config) RewriteRule ^([.a-zA-Z0-9-]+) snippets/$1.html [L] RewriteCond %{QUERY_STRING} _escaped_fragment_ RewriteCond %{REQUEST_URI} !^/(build|img|snippets|config) RewriteRule ^ snippets/1.html [L] RewriteCond %{REQUEST_URI} !^/(build|img|snippets|config) RewriteRule ^/?$ index.html [QSA,L] RewriteCond %{REQUEST_URI} !^/(build|img|snippets|config) RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^[.a-zA-Z0-9-]+(/(.*))? $2 [QSA,N]

How it works

Below is the explanation of how routing works in Readymag projects. All paths in the code are relative: your server needs to be configured to serve them.