Giter Club home page Giter Club logo

canfar-portal's Introduction



CANFAR.net

Website code for CANFAR.net.

The layout is all Jekyll with Markdown.

Building the static site

Jekyll has a Docker image that can be used to compile the site's source into a static distribution that can then be used to deploy to a running proxy server.

The provided build.sh script will work. It will build for Production by default, but can be used to build to any configured environment declared in the _config.yml file. It is currently configured for demo, rc, and prod (Default):

...
env:
    demo:
        cadc: 'demo.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'
        canfar: 'demo.canfar.net'
        apps: 'demo.canfar.net'
    rc:
        cadc: 'rc.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'
        canfar: 'rc-www.canfar.net'
        apps: 'rcapps.canfar.net'
    prod:
        cadc: 'www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'
        canfar: 'www.canfar.net'
        apps: 'apps.canfar.net'
...
```ls


Custom environments can be added:
```yaml
env:
    ...
    mystaging:
      cadc: 'staging.cadc.ca'
      canfar: 'staging.canfar.net'
      apps: 'staging.canfar.net'
    ...

Then run:

./build.sh mystaging

When the build is finished, the _site folder will contain the compiled static files, with the links set appropriate to the environment configuration.

Running locally (Development)

For development and testing, one can setup their own Jekyll server, or simply pull the official Docker container like so:

docker pull jekyll/jekyll:pages

which is meant as very close simulation of running the site on GitHub.

Then it can be run by cloning this repository. Ensure the HOSTNAME variable is set: export HOSTNAME=myhost.com

or add it into a .env file in this folder.

Then starting the Docker container using the supplied docker-compose.yml file:

~$ mkdir $HOME/src && cd $HOME/src
~$ git clone https://github.com/canfar/canfar.github.io canfar_site
~$ cd canfar_site
~$ docker-compose up -d

Or directly using the docker command:

~$ mkdir $HOME/src && cd $HOME/src
~$ git clone https://github.com/canfar/canfar.github.io canfar_site
~$ docker run --rm --name canfar-site -p 4000:4000 -v $(pwd)/canfar_site:/srv/jekyll canfar/canfar-site bundle install && bundle exec jekyll s --incremental

Then point a browser to the local site.

Normal development can occur in the $HOME/src/canfar_site directory and will be immediately reflected after a page refresh.

Also, if the _config.yml file contains a baseurl value, it should be commented out before the server starts (or comment it out then restart).

Configuration

The configuration is handled by YAML files located in the _data directory.

This file contains every textualized item on the site. The original (and possibly future) intent was to have a bi-lingual site, so both the fr and en versions have been maintained.

This also offers a convenient way to store re-usable items from the menus so that we can maintain consistency between the left menu and the drop down menus.

This is menu layout for the dropdown menus and related left-menu (side nav). The format is: <menuname>: [<items>]

Where <menuname> is the related name in translations.yml under the language. The <items> are the same, but they can also be declared as hierarchical using dot (.) notation.

For example, the Services dropdown menu is made up of first level and second level (indented) items like so:

services: ['uvic', 'uvic.cloud_portal', 'cadc', 'cadc.digital_object_identifiers', 'cadc.storage', 'cadc.batch_processing', 'cadc.group_management']

Which will look in the translations.yml file for:

%PAGE_LANGUAGE%/services to get the name to display (Service), then, for each item, will look for %PAGE_LANGUAGE%/services/%ITEM_PATH% to get their links and names to display.

This is just a configurable way to set the looping showcase images on the front page.

canfar-portal's People

Contributors

at88mph avatar djscadcgit avatar sfabbro avatar ijiraq avatar hjeeves avatar yeunga avatar severingaudet avatar fherwig avatar brianmajor avatar dependabot[bot] avatar low-sky avatar nishchintdhawan avatar zombiepig01 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.