remote-jobs/site
James Nylen dac8b04fc8
Add full profile search (#763)
* Prevent duplicate company names

* Fix output indentation

* Search full profile content using lunr.js

* Remove extra stop words

This wasn't really working correctly - the stop word 'work' would leave
instances of 'working' and 'works' in the index for example.

* Change company name description from "Name" to "Company name"

* Pre-process query:

- Search for terms in AND mode, per
  https://lunrjs.com/guides/searching.html#term-presence
- Discard non-alphanumeric characters from the search
- Better handling of contractions and searching for stop words

* Display search query and results in the console

* Add special search token: _incomplete

* Add a link to search for incomplete profiles

* Revert "Add a link to search for incomplete profiles"

This reverts commit f6384c90cb.

* Add link to search documentation

* Improve search explanation appearance when it spans multiple lines

* Fix searching for contractions

Previously, searching for e.g. "don't" wasn't working correctly. After
trimming the contraction, "do" is a stop word, so it should be ignored.

* Improve "empty search" message

* Prefer matches other than "company name" in search excerpts

* Move inline scripts before external scripts

This probably doesn't matter right now due to the way the scripts are
currently structured, but it might matter one day and it's more logical
this way.

* Fix search engine index progress

* Improve script indentation

* I got 99 problems and they're all bots

* Update script exit code

When a Node.js error occurs the exit code is probably going to be 1, so
we should use a different code.

* Fix the tests

* Update documentation

This was wrong (out of date), but the correct version is obvious from
reading the code.

* Make download progress work in both Chrome and Firefox

See https://stackoverflow.com/a/32799706
2020-05-06 07:42:21 +01:00
..
assets Add full profile search (#763) 2020-05-06 07:42:21 +01:00
templates Add full profile search (#763) 2020-05-06 07:42:21 +01:00
README.md Static site improvements (#467) 2018-08-12 23:12:18 -05:00

Static site generator

Overview

This folder contains the template files needed to generate the static site for this repo ( https://remoteintech.company/ ).

The code that parses the site's data from the Markdown files in this repository is located in bin/build-site.js and lib/index.js.

On each new change to master or to a GitHub pull request, if there are no data validation errors, the site is built and deployed to Netlify (the domain mentioned above for the master branch, or a temporary subdomain for pull requests).

The static site uses a layout and CSS copied from https://blog.remoteintech.company/ which is a site hosted on WordPress.com, and the site builder code uses swig as an HTML templating engine.

Development

If you submit any changes as a pull request, GitHub and Netlify will automatically validate, build, and deploy a preview of the site for you.

For longer-running or more complicated changes, though, it can be useful to run the site locally. To make this work, you should be using the version of Node.js specified in the .nvmrc file. Other versions may work but have not been tested.

Run npm install to install dependencies.

Then run npm start to build and serve the site locally.

You can also use nodemon to automatically rebuild and reload the site when you make changes:

npm install -g nodemon
nodemon bin/serve-site.js

If you just want the data structure used to build the site, you can do this:

~/code/remote-jobs $ node
> const { parseFromDirectory } = require( './lib' );
undefined
> const data = parseFromDirectory( '.' );
undefined
> Object.keys( data );
[ 'ok',
  'profileFilenames',
  'profileHeadingCounts',
  'companies',
  'readmeContent' ]
> Object.keys( data.companies[ 0 ] )
[ 'name',
  'isIncomplete',
  'websiteUrl',
  'websiteText',
  'shortRegion',
  'linkedFilename',
  'profileContent' ]
...