Skip to content
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

Merged
merged 11 commits into from
Nov 13, 2023
Merged

Conversation

e111077
Copy link
Collaborator

@e111077 e111077 commented Nov 11, 2023

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

MDN link example Video Example
Screenshot 2023-11-10 at 4 46 20 PM Screenshot 2023-11-10 at 4 49 35 PM

@e111077 e111077 force-pushed the index-videos-and-extra branch from e79a2c2 to 1bde9a5 Compare November 11, 2023 02:36
@e111077 e111077 force-pushed the index-videos-and-extra branch from da37746 to 1bde9a5 Compare November 11, 2023 04:06
Base automatically changed from custom-algolia-uploads to main November 11, 2023 19:27
Copy link
Contributor

@AndrewJakubowicz AndrewJakubowicz left a 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.",
Copy link
Contributor

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?

Copy link
Collaborator Author

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') {
Copy link
Contributor

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:

if (!DEV) {
// Only create the search index in production when we'll be uploading it
// to algolia.
await createSearchIndex(ENV.eleventyOutDir);
}

packages/lit-dev-content/src/components/litdev-search.ts Outdated Show resolved Hide resolved
packages/lit-dev-tools-cjs/src/search/plugin.ts Outdated Show resolved Hide resolved
packages/lit-dev-tools-cjs/src/search/plugin.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@AndrewJakubowicz AndrewJakubowicz left a 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!

@e111077 e111077 merged commit 8909539 into main Nov 13, 2023
13 of 14 checks passed
@e111077 e111077 deleted the index-videos-and-extra branch November 13, 2023 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants