diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..831c9ad
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,27 @@
+source "https://rubygems.org"
+
+# Hello! This is where you manage which Jekyll version is used to run.
+# When you want to use a different version, change it below, save the
+# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
+#
+# bundle exec jekyll serve
+#
+# This will help ensure the proper Jekyll version is running.
+# Happy Jekylling!
+gem "jekyll", "~> 4.3.3"
+
+gem 'jekyll-remote-theme'
+
+# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
+# and associated library.
+platforms :mingw, :x64_mingw, :mswin, :jruby do
+ gem "tzinfo", ">= 1", "< 3"
+ gem "tzinfo-data"
+end
+
+# Performance-booster for watching directories on Windows
+gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
+
+# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
+# do not have a Java counterpart.
+gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
diff --git a/README.md b/README.md
index 45b3281..bf1b1fc 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ Search UI follows [Semantic Versioning 2.0.0](https://semver.org/)
This rubric is for developers.
-### Build files
+### Build files for release or to test code quality before opening a Pull request
1. run: npm install -g grunt-cli
2. run: npm install
@@ -51,19 +51,34 @@ This rubric is for developers.
### Test as end-user
+#### Locally (with Docker)
+
+1. Install Docker
+2. Add an API key to your site settings as described below in [Setting an API key](#setting-an-api-key). Otherwise, please see [Alternative to the API key by getting a token](#alternative-to-the-api-key-by-getting-a-token) below.
+3. run `docker compose up --build`
+
+#### Through GitHub Pages
+
1. Push to a branch in your origin remote, in a branch of your choice. It is recommended that you use a dedicated branch for testing, which is different from one where you would be opening a Pull request from.
2. Make sure your repository has GitHub Pages enabled, on that specific above-mentioned branch.
-3. Since you need a token to communicate with the Coveo API, you can do the following to go to get a token valid for 24 hrs:
- 1. Go to a search page on the Canada.ca preview such as: **/en/sr/srb.html**.
- 2. Open the inspector (developer tool) and look for the `div` tag that has the attribute called `data-gc-search`.
- 3. Inside this attribute, you'll find a Javascript object that has a field called `accessToken`. Grab the value of that token.
- 4. Replace `XYZ` with the token on any page within the /test/ folder of this project, such as **srb-en.html**.
- 5. If you are planning on opening a pull request with your changes, do not forget to put `XYZ` back into the files.
- 6. If the token doesn't seem valid, take another one from the Canada.ca Preview server or you may have passed the 24 hours TTL of the token; get another one.
+
+#### Setting an API key
+
+1. Add a file named `token.yml` inside the `_data` folder. This file needs to simply have a key-value pair of `API_KEY: "[API KEY HERE]"` on line 1. The key value can be found at https://github.com/ServiceCanada/devops-documentation/blob/master/search/local-testing.md to replace the `[API KEY HERE]`. If you do not have access to the previous link, please see the next section on how to use a token as described below.
+
+#### Alternative to the API key by getting a token
+
+Since you need a token to communicate with the Coveo API, you can do the following to go to get a token valid for 24 hrs:
+
+1. Go to a search page on the Canada.ca preview such as: **/en/sr/srb.html**.
+2. Open the inspector (developer tool) and look for the `div` tag that has the attribute called `data-gc-search`.
+3. Inside this attribute, you'll find a Javascript object that has a field called `accessToken`. Grab the value of that token.
+4. Add a file named `token.yml` in the `_data` folder. This file needs to simply have a key-value pair of `API_KEY: "[API KEY HERE]"` on line 1. Add the token value as the key in `[API KEY HERE]`.
+5. If the token doesn't seem valid, take another one from the Canada.ca Preview server or you may have passed the 24 hours TTL of the token; get another one.
### Deployment
-1. Take the content of the "dist" folder and put it on a server. Make sure you have a mechanism in place to handle a key/token
+1. The content of the "dist" folder is what's needed for a release / deployment. See [Build files](#build-files) section above to generate this folder.
### Configurations, templates and parameters
@@ -84,9 +99,7 @@ They must be used within the `[data-gc-search]` attribute. See the **/test/src-e
- `lang`
: Langague of the text to output, in short format (`en` or `fr`). Will detect the langauge of the HTML page if not defined. If not determined, default is: `en`
- `numberOfSuggestions`
-: Number of suggestions to show in the Query suggestion box. Default: `0`
-- `unsupportedSuggestions`
-: Extra mechanism to allow the use of the very early on Query suggestion feature. Default: `false`
+: Number of suggestions to show in the Query Suggestion (QS) box. This will activate the QS feature on your search page. Default: `0`
- `enableHistoryPush`
: Allows for UI elements that are not hyperlink tags to register their action in the history, such as pagination. Default: `true`
- `isContextSearch`
@@ -202,3 +215,9 @@ Sometimes your search pages contain more than one input relevant to the search's
: Search , within documents of a certain file type. Options are: `application/pdf`, `ps`, `application/msword`, `application/vnd.ms-excel`, `application/vnd.ms-powerpoint`, `application/rtf`
- `originLevel3`
: Allows for mimicking a specific search page/context by setting its path through this URL parameter
+
+### Other
+
+#### Analytics tracking
+
+Custom event named `searchEvent` can used to hook onto from Analytics tools, such as Adobe Analytics. This allows to listen to search actions, more specifically "doing a search", since the Search UI is acting similar to a Single Page App (SPA).
diff --git a/_config.yml b/_config.yml
index 9695591..393f475 100644
--- a/_config.yml
+++ b/_config.yml
@@ -1,10 +1,35 @@
+plugins:
+ - jekyll-remote-theme
+
remote_theme: wet-boew/gcweb-jekyll
+
title: Search UI for Canada.ca Search
-#
-# Page front matter defaults
defaults:
- scope:
path: "" # Ensure it's applied to all pages
values:
layout: default
+
+exclude:
+ - .sass-cache/
+ - .jekyll-cache/
+ - gemfiles/
+ - Gemfile
+ - Gemfile.lock
+ - node_modules/
+ - vendor/bundle/
+ - vendor/cache/
+ - vendor/gems/
+ - vendor/ruby/
+ - docker-compose.yml
+ - Gruntfile.js
+ - dist/
+ - package.json
+ - package-lock.json
+ - LICENSE
+ - CONDE_OF_CONDUCT.md
+ - CONTRIBUTING.md
+ - SECURITY.md
+ - README.md
+ - todo.md
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..8e2b198
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,8 @@
+services:
+ jekyll:
+ image: bretfisher/jekyll-serve
+ container_name: search-ui-site
+ volumes:
+ - .:/site
+ ports:
+ - '4000:4000'
diff --git a/index.html b/index.html
index 64d4e83..bd983a8 100644
--- a/index.html
+++ b/index.html
@@ -2,15 +2,21 @@
title: Search user interface (UI) with Headless
---
-
Section Résultats attendu pour la section de résultats
+
+ Section Résultats générée
+ [À compléter, voir Connector.js comme référence pour l'instant]
+
diff --git a/todo.md b/todo.md
index cf7f0a8..6af20b0 100644
--- a/todo.md
+++ b/todo.md
@@ -2,12 +2,18 @@
This list contains outstanding suggestions / non-critical issues identified in previously merged pull requests. The following items do need to be addressed in due time.
+- [x] Potentially come up with an easier way to test locally
+- [x] Add includes of JS (src) files in a baked in Jekyll variables instead of hardcoded
+- [x] Revisit the need to search for postscript and rich text documents (ps and rtf. Are they needed? What's the usecase?
+- [x] Revisit the "window.location.origin.startsWith( 'file://' )" condition
+- [x] Investigate Pagination styles when testing from GitHub
+- [x] Investigate #wb-land focus on Advanced search
+- [x] Document customEvent
+- [x] Finish proper development of Query Suggestion (QS), outside of GCWeb
+- [ ] Move QS generic integration to GCWeb
- [ ] Remove the need for having a CSS file to be handled by GCWeb instead!
- [ ] Add missing pieces such as "error message", "no result" and "did you mean" into our reference implementation as an example
-- [ ] Potentially come up with an easier way to test locally
- [ ] Add Expected output on test pages (HTML) and use Jekyll highlights
-- [ ] Finish proper development of Suggestion box (type-ahead)
-- [x] Add includes of JS (src) files in a baked in Jekyll variables instead of hardcoded
- [ ] Align search pages with new GCWeb template and/or define new GCWeb templates
- [ ] Ensure no section or heading or any element with semantic is added alone/empty on the page
- [ ] Improve the form code to not rely on an action that points to an anchor for a dynamically added element, which doesn't exist on the page prior to JS
@@ -17,10 +23,5 @@ This list contains outstanding suggestions / non-critical issues identified in p
- [ ] Revisit how dates are handled for output formats (need an array of months?)
- [ ] Make IDs configurable for "suggestion", "result-list", "result-link", "query-summary", "pager"
- [ ] Revisit customEvent to potentially be scoped to the search-ui element instead of document
-- [ ] Document customEvent
- [ ] Improve warning message when Headless doesn't load
- [ ] "numberOfPages: 9" and "automaticallyCorrectQuery: false" should be configurable through parameters
-- [ ] Revisit the need to search for postscript and rich text documents (ps and rtf. Are they needed? What's the usecase?
-- [ ] Revisit the "window.location.origin.startsWith( 'file://' )" condition
-- [x] Investigate Pagination styles when testing from GitHub
-- [x] Investigate #wb-land focus on Advanced search