Skip to content

Add landing page feature flag #663

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

Merged
merged 23 commits into from
Mar 4, 2025
Merged

Add landing page feature flag #663

merged 23 commits into from
Mar 4, 2025

Conversation

reakaleek
Copy link
Member

@reakaleek reakaleek commented Mar 3, 2025

cursorful-video-landing-page-1741101919376.mp4

@Copilot Copilot AI review requested due to automatic review settings March 3, 2025 16:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR introduces a landing page feature flag and related UI adjustments while refactoring hx attribute generation across several views.

  • Introduces a new feature flag for landing page rendering in FeatureFlags.cs.
  • Updates Htmx helper methods and associated templates to use consolidated hx attribute generation.
  • Adjusts DOM element selectors and minor refactoring in assets and layout views.

Reviewed Changes

File Description
src/Elastic.Markdown/IO/Configuration/FeatureFlags.cs Adds support for a landing page feature flag with environment variable overrides.
src/Elastic.Markdown/Helpers/Htmx.cs Updates hx attribute helper methods with a new condition in GetHxSelectOob.
docs/_docset.yml Updates feature flag defaults to enable primary-nav and landing-page.
src/Elastic.Markdown/Assets/copybutton.ts Changes default SVG icon for the copy button and updates the element selector.
src/Elastic.Markdown/Slices/HtmlWriter.cs Removes an unused using directive for Configuration.
src/Elastic.Markdown/Slices/_Layout.cshtml Adds conditional rendering for the landing page and assigns element IDs.
src/Elastic.Markdown/Slices/Layout/_Header.cshtml Refactors hx attribute application by using a consolidated helper call.
src/Elastic.Markdown/Slices/Layout/_Breadcrumbs.cshtml Refactors hx attributes in breadcrumbs and updates meta tag position calculation.

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (4)

src/Elastic.Markdown/Helpers/Htmx.cs:15

  • Consider validating that currentUrl has sufficient length before slicing with currentUrl[startIndex..] to guard against potential runtime errors.
if (currentUrl[startIndex..] == "/")

src/Elastic.Markdown/Assets/copybutton.ts:151

  • [nitpick] Confirm that the updated COPYBUTTON_SELECTOR without the '.markdown-content' qualifier is intentional and matches the intended DOM structure.
const COPYBUTTON_SELECTOR = 'div.highlight pre';

src/Elastic.Markdown/Slices/Layout/_Breadcrumbs.cshtml:25

  • [nitpick] Verify that using @(index+2) for the breadcrumb position accurately reflects the hierarchy, ensuring there is no off-by-one error in the metadata.
<meta itemprop="position" content="@(index+2)">

src/Elastic.Markdown/IO/Configuration/FeatureFlags.cs:18

  • [nitpick] Clarify the decision to treat non-boolean environment variable values as 'enabled' by adding more detailed comments or unit tests to document this behavior.
// if the env var is set but not a bool, we treat it as enabled

@reakaleek reakaleek force-pushed the feature/landing-page-feature branch from 2b52452 to 801eca4 Compare March 4, 2025 11:25
Comment on lines +14 to +15
primary-nav: true
landing-page: true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
primary-nav: true
landing-page: true
primary-nav: false
landing-page: false

Copy link
Contributor

@florent-leborgne florent-leborgne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First round of review!

Start free trial
</a>
<a href="/deploy-manage/upgrade" class="grow cursor-pointer text-blue-elastic hover:text-blue-elastic-100 text-nowrap border-2 border-blue-elastic hover:border-blue-elastic-100 focus:ring-4 focus:outline-none focus:ring-blue-300 font-semibold rounded-sm px-6 py-2.5 text-center h-10 flex items-center justify-center">
Upgrade
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A note suggesting to move this to the header next to troubleshoot & co link

<p class="mt-4">Follow these step-by-step instructions to install, administer, and use Elastic — no matter your use case.</p>
<div class="flex lg:inline-flex gap-3 mt-9">
<a href="https://cloud.elastic.co/registration" class="grow select-none cursor-pointer text-white text-nowrap bg-blue-elastic hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-semibold rounded-sm px-6 py-2.5 focus:outline-none h-10 flex items-center justify-center">
Start free trial
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this, this is visually connected to "Elastic documentation" while it's not related. The button also exists already in the header.

<div class="flex flex-col lg:flex-row lg:items-center gap-6 mt-6">
<div class="lg:basis-[50%] rounded-xl border-1 border-grey-20 p-6">
<p>Elastic overview</p>
<p class="mt-2">Lorem ipsum dolor sit amet, consectetur adipiscing elitLorem ipsum dolor sit amet, consectetur adipiscing elit</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p class="mt-2">Lorem ipsum dolor sit amet, consectetur adipiscing elitLorem ipsum dolor sit amet, consectetur adipiscing elit</p>
<p class="mt-2">Learn about Elasticsearch, the components at the heart of the Elastic Search AI Platform, and the solutions it powers.</p>

To give a better idea of what's behind the link. Should link to the get-started main page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reakaleek this is outdated since you modified these lines according to the Gdoc in between. But I think it's still valid

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, for pushing changes!

I will consider this and other cases!

Comment on lines 31 to 34
<div class="lg:basis-[50%] rounded-xl border-1 border-grey-20 p-6">
<p>Elastic architecture</p>
<p class="mt-2">Lorem ipsum dolor sit amet, consectetur adipiscing elitLorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<div class="lg:basis-[50%] rounded-xl border-1 border-grey-20 p-6">
<p>Elastic architecture</p>
<p class="mt-2">Lorem ipsum dolor sit amet, consectetur adipiscing elitLorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</div>

I think we need only 1 path to keep things simple and clear for readers

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reakaleek this is outdated since you modified these lines according to the Gdoc in between. But I think it's still valid

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

This looks a bit odd. I think we need more fitting design for this.

reakaleek and others added 2 commits March 4, 2025 13:11
@reakaleek reakaleek requested a review from a team March 4, 2025 15:23
@reakaleek reakaleek requested a review from Copilot March 4, 2025 15:46
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR introduces a feature flag for the landing page and updates various components to support conditional rendering and behavior based on this flag. Key changes include modifying feature flag evaluation and error handling, adjusting layout and navigation rendering for the landing page, and updating related documentation and assets.

Reviewed Changes

File Description
src/Elastic.Markdown/IO/Configuration/FeatureFlags.cs Adds a landing page flag and adjusts environment variable evaluation for feature flags.
src/Elastic.Markdown/Helpers/Htmx.cs Updates the hx-select-oob logic to handle landing page rendering and changes how target selectors are constructed.
src/Elastic.Markdown/Slices/_ViewModels.cs Introduces a new IsLandingPage property based on the landing page flag.
docs/_docset.yml Enables primary-nav and landing-page features for documentation previews.
src/Elastic.Markdown/Assets/copybutton.ts Updates the copy button icon SVG and adjusts the code cell selector.
src/Elastic.Markdown/Assets/pages-nav.ts Modifies viewport checking logic to incorporate the parent element and update scrolling behavior.
src/Elastic.Markdown/Slices/HtmlWriter.cs Removes an unused using directive for configuration.
src/Elastic.Markdown/Slices/_Layout.cshtml Incorporates conditional layout logic for landing page rendering.
src/Elastic.Markdown/Slices/Layout/_SecondaryNav.cshtml Conditionally renders nav elements based on landing page state.
src/Elastic.Markdown/Slices/Layout/_PrimaryNavDropdownItem.cshtml Tweaks CSS classes for consistent spacing.
src/Elastic.Markdown/Slices/Layout/_Header.cshtml Updates a navigation link from security to observability.
src/Elastic.Markdown/Slices/Layout/_Breadcrumbs.cshtml Adjusts breadcrumb rendering and hx attributes for improved navigation behavior.

Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

src/Elastic.Markdown/Helpers/Htmx.cs:26

  • selectTargets is a string rather than a collection; using string.Join will split the string into individual characters. Consider returning the string directly instead of using string.Join.
return string.Join(',', selectTargets);

@reakaleek reakaleek merged commit 19ce453 into main Mar 4, 2025
8 checks passed
@reakaleek reakaleek deleted the feature/landing-page-feature branch March 4, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants