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
docker
anddocker-compose
already installed and working. If not, install Docker and Compose and come back.
- Clone this repo
~$ git clone https://github.com/i-am-gizm0/svelte-gallery.git ~$ cd svelte-gallery
- Copy
.env.example
to.env
and configure it to your liking~/svelte-gallery$ cp .env.example .env
- Build and start the image and start publishing!
~/svelte-gallery$ docker-compose up -d
Most of what you'll do will happen in galleries
.
Note An example gallery is available in the
galleries
folder.
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.- It consists of
group
s, which correspond to a dropdown menu. Agroup
can have aname
attribute, which is the text displayed in the navbar.- A
group
contains multiplegallery
elements, which have apath
attribute (the link to the gallery) and aname
, again the text displayed
- A
- It consists of
collections
contains a group of galleries to be presented to a visitor- It consists of
collection
s, which have anid
and aname
.- A
collection
contains multiplegallery
elements, which have apath
attribute (the link to the gallery)
- A
- It consists of
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 itsgallery.xml
The galleries
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 children
meta
defines some properties of the gallery.title
is the simple title of the galleryoverrides
are different versions of the title: Currently supported aresmall-large
andlarge-small
, each withsmall
andlarge
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 oneimg
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.- A Markdown section (
<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. - A Featured section (
<section type="featured">
) will display one image at the full width of the page. It contains oneimg
element. - Probably the most common section will be the Gallery section (
<section type="gallery">
). It defines a group of images which can be interacted with (opened in a lightbox). It can contain as manyimg
elements are you'd like.
- A Markdown section (
resources
defines images that can be accessed from elsewhere in the gallery by theirid
. It contains at least oneimg
element that has anid
attribute.
Images 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:
- Link
This does not define anything for itself, but instead links to an image defined inresources
. It has a singlelink
attribute that references theid
of a resource image, where<img id="img01" ... />
would be referenced by<img link="#img01" />
- Resource
This defines an image. It contains the following attributessrc
- 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
andheight
- 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-screen
Note This assumes you have
npm
already installed and working. If not, install Node and come back
- Clone this repo
~$ git clone https://github.com/i-am-gizm0/svelte-gallery.git ~$ cd svelte-gallery
- Install the dependencies
~/svelte-gallery$ npm install
- Copy
.env.example
to.env
and configure it to your liking~/svelte-gallery$ cp .env.example .env
- Start the development server and start writing code!
~/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.