-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Algolia #239
Algolia #239
Conversation
layouts/_default/index.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this file? We shouldn't be committing generated files in this project. You can get Hugo to generate a JSON file automatically from the site content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I saw that auto generation didn't work for me so I copied the information manually. Let me try it again to auto-generate
@@ -13,3 +13,4 @@ jsonschema = 'https://json-schema.org' | |||
[markup.highlight] | |||
lineNos = false | |||
noClasses = false | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, .toml files shouldn't have empty lines in the end?? I and any config file?.. I'll change it,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think any file format as a requirement of an empty line at the end that I'm aware of
assets/main.scss
Outdated
@@ -146,3 +146,16 @@ details:not([open]) summary i { | |||
@extend .d-inline-block; | |||
transform: rotate(-90deg); | |||
} | |||
|
|||
/* Customizing the search button color */ | |||
.btn-outline-success { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should never override Bootstrap classes. Bootstrap provides a way to override main colors through SCSS variables and also supports plenty of helpers to customize colors, border colors, etc of arbitrary elements.
@@ -5,3 +5,68 @@ import Tooltip from './vendor/bootstrap/js/src/tooltip.js'; | |||
for (const element of document.querySelectorAll('[data-bs-toggle="tooltip"]')) { | |||
new Tooltip(element); | |||
} | |||
|
|||
// Fuse search options | |||
var fuseOptions = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var
is an old and no longer used JavaScript construct. You should use const
or let
layouts/partials/navigation.html
Outdated
|
||
<form class="d-flex justify-self-end" id="search-form"> | ||
<input class="form-control me-2" type="search" name="q" id="search-query" placeholder="Search" aria-label="Search"> | ||
<button class="btn btn-outline-success" type="submit">Search</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably no need to have a submit button, as it is not a form you would be submitting anyway. Ideally we just have the search input and we search as the user types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" Search as the user inputs" means we will keep redirecting as user inputs or keep changing suggestions like in JSON Schema website as user inputs ?? 1 or 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No redirection. Exactly like in the JSON Schema official website: we dynamically change the dropdown with the search results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that means the dropdown has to be displayed dynamically, and stop so that user can chose... I don't know how it works with Fuse. In JSON Schema.org they use React library from Algolia itself to have that functionality.
Are there any suggestions..? That how dynamic search and listing can be done in UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to doing with plain JavaScript + Bootstrap. i.e. load a Bootstrap dropdown upon search results. Or if you can create a JavaScript function that gives you the search results given a search term as an array I can help doing the UI
<button class="btn btn-outline-success" type="submit">Search</button> | ||
</form> | ||
|
||
<div class="navbar-nav d-flex "> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div class="navbar-nav d-flex "> | |
<div class="navbar-nav d-flex"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few comments have various comments about the JavaScript part, but it doesn't seem to work for me at all. I don't see anything if I type on the search bar or submit, as if nothing happens at all. Does it work for you?
This is the recording of the working : it redirects directly, .. search-bar.mp4 |
I don't get the dropdown at all. What browser are you using? Maybe try other ones? Untitled.mov |
That dropdown isn't code defined, yeah its because of the browser - Chrome browser.
That dropdown is a browser behavior. Right now it works only if the search button is clicked. Let's implement listing functionality too.. |
@jviotti I have made the major changes, styling and html should be polished.
|
@jviotti autogeneration is happening now, can you check for the funtionality.. then we can go ahead with UI then code correction |
Woah! Super cool already! One small UI suggestion: when displaying a keyword, can you also showcase what dialect and vocabulary they belong to? |
Can you extract the parts of this PR that generate the JSON index as a separate PR? I think we can get that merged now while we focus on polishing the rest |
layouts/_default/baseof.html
Outdated
<script defer src="{{ $js.Permalink }}"></script> | ||
<script async src="{{ $js.Permalink }}"></script> | ||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.6.2/fuse.min.js" integrity="sha512-Nqw1tH3mpavka9cQCc5zWWEZNfIPdOYyQFjlV1NvflEtQ0/XI6ZQ+H/D3YgJdqSUJlMLAPRj/oXlaHCFbFCjoQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pull these dependencies using NPM on package.json
?
Okay.. I got the reason for it . For the UI shall I include both of them in right as a smaller size text ? I may have to override bootstrap I guess |
Not sure about the style. Give it your best shot while changing the least amount of possible in Bootstrap and then I'll help! |
@jviotti I have made the changes, I have updated package.json too, should I have another PR for index.json... 100%? |
Yeah, let's do a separate PR. A sequence of smaller PRs is always better than 1 bigger PR! At least we have the JSON part out of the way, and we focus on the rest. |
I tried fuse search and it was successful, please check if this works,
IF yes next will be:
searchbar positioning
Implement same for vocabulary page and dialect page
Customize fuseOptions much better