-
Notifications
You must be signed in to change notification settings - Fork 189
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
index videos and add external data to search #1266
Conversation
e79a2c2
to
1bde9a5
Compare
A live preview of this PR will be available at the URL(s) below. https://pr1266-1bde9a5---lit-dev-5ftespv5na-uc.a.run.app/ |
da37746
to
1bde9a5
Compare
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.
This is looking fantastic! Thank you for doing this!
"relativeUrl": "https://web.dev/articles/more-capable-form-controls", | ||
"title": "More capable form controls", | ||
"heading": "", | ||
"text": "With a new event, and custom elements APIs, participating in forms just got a lot easier. Many developers build custom form controls, either to provide controls that aren't built in to the browser, or to customize the look and feel beyond what's possible with the built-in form controls. However, it can be difficult to replicate the features of built-in HTML form controls. Consider some of the features an <input> element gets automatically when you add it to a form: The input is automatically added to the form's list of controls. The input's value is automatically submitted with the form. The input participates in form validation. You can style the input using the :valid and :invalid pseudoclasses. The input is notified when the form is reset, when the form is reloaded, or when the browser tries to autofill form entries. Custom form controls typically have few of these features. Developers can work around some of the limitations in JavaScript, like adding a hidden <input> to a form to participate in form submission. But other features just can't be replicated in JavaScript alone. Two new web features make it easier to build custom form controls, and remove the limitations of current custom controls: The formdata event lets an arbitrary JavaScript object participate in form submission, so you can add form data without using a hidden <input>. The Form-associated custom elements API lets custom elements act more like built-in form controls. These two features can be used to create new kinds of controls that work better.", |
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.
Is this maybe a bit long? Will Algolia return this whole block of text for the search -option text snippet?
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.
it only returns the relevant snippet like in the first image
@@ -7,6 +7,9 @@ import path from 'path'; | |||
import {docIndexer, UrlToFile, walkDir} from './utils.js'; | |||
|
|||
export const indexDocs = async (outputDir: string, idOffset = 0) => { | |||
if (outputDir === '_dev') { |
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'm not sure this is needed, since indexDocs should not run in dev mode.
Reference:
lit.dev/packages/lit-dev-content/.eleventy.js
Lines 584 to 588 in eece220
if (!DEV) { | |
// Only create the search index in production when we'll be uploading it | |
// to algolia. | |
await createSearchIndex(ENV.eleventyOutDir); | |
} |
packages/lit-dev-tools-cjs/src/search/indexers/index-external-data.ts
Outdated
Show resolved
Hide resolved
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.
Have not manually tested, but code looks great. Thank you for this awesome contribution!
indexes videos and "extra external stuff" and puts it on algolia index + the search box.
NOTE: this was tested on the lit_dev_test algolia index with a manual update which i have reverted to the
"lit.dev"
prod index before pushing so it won't be visible in the snapshots