Skip to content

Static Site generator but for images. Its like Hugo but for large photo galleries

License

Notifications You must be signed in to change notification settings

robrotheram/gogallery

Repository files navigation

GoGallery

Its like Hugo but for large photo galleries

GoGallery is a static site generator designed just for large photo sets. The problem is that just my modest approximate 1000 image gallery is around 5GB in size. This means traditional static stie generators where you host everything is github is not going to work. Also I do not want to keep reorgaising my photos or rely on some database. I have my photo in folders (albums) and I needed a tool to generate a webpage for those images.

Incomes GoGallery just point it at your photos and it will generate a static site for with a customizable theme. The template language is Handlebars no fancy Javascript single page webapps here. What is included. is image optomization into multiple sizes for the web and the site also generates a PWA so it can act like a desktop/mobile app. Chrome Lighthouse scores the site at 93/100 for performance and 95/100 for accessibility

The Software also has a dashboard that you can use to manage the photos e.g change captions add albums to be hidden etc. You can also preview the site using the serve command

Usage

gogallery [flags]

Options

      --config string   config file (default is $HOME/.gogallery.yaml)
  -h, --help            help for gogallery

SEE ALSO


History

The inspiration for this gallery is to provide a some of the functionaities of my old gallery cms Koken which has had no updates in over a year+ and had gone silent. NOTE that this is not a replacement for Koken just the very limited features I was using.

The application uses react frontend and a seperate react dashboard that supports upload and managing photos in collections.

Demo

Demo at https://gallery.exceptionerror.io

Screenshots

Gallery

Screenshot1 Screenshot1

Dashboard:

Screenshot1 Screenshot1 Screenshot1

Installation

Makefile to the rescue

build all

    make

build dashboard

    make build-dashboard

build server

    make build-server

Usage

Edit the config and change the name basepath and base folder that is used for scanning images

Dashboard login

Gogallery on first run will autocreate a admin accound with username admin and a 8 character autogenerated password which you will find in the log. Once loged in you can go to settings and user to set it

Dashboard url %GALLERY_PATH/dashboard

If you forget the admin password for any reason you can use the gogallery --reset-admin which will recrate the admin username and password

Themes

Version 5.x has support for users themes. The theme engine uses Go’s html/template and text/template libraries as the basis for the templating. This is similar to the one hugo uses https://gohugo.io/templates/introduction/ but with the varibles being different.

All Themes will need to have the following pages in order for the site to work:

  • 404.hbs
  • albums.hbs
  • collections.hbs
  • main.hbs
  • photo.hbs

Optionally you can have a "default.hbs" to define common heading and footers The engine has support for partials that can be stored in the subfolder partials and all other assests can be stored the assets folder.

See the example theme eastnor for reference

Caching

The server implements its own caching layer after the page has been visited it will cache the page in memory so next load of that page becomes very quick this can produce 10X improvement of load times.

The Cache gets invalidated if the server restarts or if you have made a change in the dashboard.

Docker Configuration

Config can be also edited via environmental variables

GLLRY_SERVER_PORT
GLLRY_SERVER_WORKERS
GLLRY_SERVER_CAPTIONURL

GLLRY_DATABASE_BASEURL

GLLRY_GALLERY_NAME
GLLRY_GALLERY_BASEPATH
GLLRY_GALLERY_URL
GALLRY_GALLERY_THEME
GALLRY_GALLERY_PICTUREBLACKLIST
GALLRY_GALLERY_ALBUMBLACKLIST

GLLRY_ABOUT_INSTAGRAM
GLLRY_ABOUT_TWITTER
GLLRY_ABOUT_EMAIL

GLLRY_ABOUT_WEBSITE
GLLRY_ABOUT_DESCRIPTION
GLLRY_ABOUT_PHOTOGRAPHER
GLLRY_ABOUT_BACKGROUNDPHOTO
GLLRY_ABOUT_PROFILEPHOTO

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

apache-2.0