Warning This platform is under heavy development and there may be breaking changes at any time until version 1.0.0. Until then, breaking changes will be a semver "minor" version (0.xx.0). After version 1.0.0, we will follow regular semver conventions.
Eventually I'll get this published on a container registry, but for now, you need to clone the repo and have Docker build the image.
Note This assumes you have
dockeranddocker-composealready installed and working. If not, install Docker and Compose and come back.
~$ git clone https://github.com/i-am-gizm0/svelte-gallery.git
~$ cd svelte-gallery
.env.example to .env and configure it to your liking~/svelte-gallery$ cp .env.example .env
~/svelte-gallery$ docker-compose up -d
Most of what you'll do will happen in galleries.
Note An example gallery is available in the
galleriesfolder.
This is the main configuration file for the site. It contains a top-level site element with the following children:
nav contains the navigation links that go in the bar at the top.groups, which correspond to a dropdown menu. A group can have a name attribute, which is the text displayed in the navbar.group contains multiple gallery elements, which have a path attribute (the link to the gallery) and a name, again the text displayedcollections contains a group of galleries to be presented to a visitorcollections, which have an id and a name.collection contains multiple gallery elements, which have a path attribute (the link to the gallery)defaults contains definitions of default values for places where a value is not defined elsewhere.header-image dictates the default header image. This will be displayed on the home page and any other gallery that doesn't have a header image defined in its gallery.xmlgalleries folder also contains the galleries themselves. Each folder within the galleries folder is a gallery, and the name of the folder is the slug (so galleries/testgal would be https://<yourdomain>/testgal).
Within that folder will be the images in that gallery, along with a gallery.xml. It will contain a top-level gallery element with the following childrenmeta defines some properties of the gallery.title is the simple title of the galleryoverrides are different versions of the title: Currently supported are small-large and large-small, each with small and large attributes, for defining how the name should be displayed when styled.description (optional) is some text or HTML that will be displayed under the gallery's name in the header.header-image defines the header image of the gallery. It contains one img element.sections defines the sections of the gallery. There is no limit on the number of sections or their types. Section types can be repeated.<section type="markdown">) will display rich text and is written in Markdown. There are currently some limits on the type of HTML elements that can be included.<section type="featured">) will display one image at the full width of the page. It contains one img element.<section type="gallery">). It defines a group of images which can be interacted with (opened in a lightbox). It can contain as many img elements are you'd like.resources defines images that can be accessed from elsewhere in the gallery by their id. It contains at least one img element that has an id attribute.imgImages are defined by <img> elements, which have similar syntax to HTML.
Note An
<img>should not contain any content, so it is usually written as a self-closing tag (<img ... />) to save space. An image must be one of two forms:
resources. It has a single link attribute that references the id of a resource image, where <img id="img01" ... /> would be referenced by <img link="#img01" />src - The location of the image. If served locally, this is the name of a file in the same gallery. It may also be the URL of an external image (such as from Unsplash).blurhash - The Blurhash representation of the image. Used to render a placeholder while the real image loads.width and height - self explanatory: the width and height of the imageid (optional) - the ID, referenced by a link (above).alt (optional) - alt text for the image, used for screen readerstitle (optional) - a caption, displayed when the image is full-screenNote This assumes you have
npmalready installed and working. If not, install Node and come back
~$ git clone https://github.com/i-am-gizm0/svelte-gallery.git
~$ cd svelte-gallery
~/svelte-gallery$ npm install
.env.example to .env and configure it to your liking~/svelte-gallery$ cp .env.example .env
~/svelte-gallery$ npm run dev -- --open
If you don't know Javascript or Typescript, start with the Typescript tutorial. If you don't know Svelte or SvelteKit, start with Svelte's tutorial and skim the SvelteKit docs.
galleries is the configuration for a site.
This is a standard SvelteKit project, so most stuff happens in src:routes contains the directory structure the user would see (what goes in the URL bar—see the SvelteKit Routing docs).lib contains support files.lib/components includes UI components that are reused throughout the app (probably).lib/components/gallerysections contains the different types of sections that can exist in a gallery.lib/modules includes bits of code that were created for this project but could theoretically work on their own.