-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
[2.x] Support automatic navigation priorities by prefixing a number in filenames #1709
[2.x] Support automatic navigation priorities by prefixing a number in filenames #1709
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 2.x-dev #1709 +/- ##
==========================================
Coverage 99.97% 99.97%
- Complexity 1769 1784 +15
==========================================
Files 183 184 +1
Lines 4705 4738 +33
==========================================
+ Hits 4704 4737 +33
Misses 1 1 ☔ View full report in Codecov by Sentry. |
Thinking on how to best implement this, since we want to strip the numbers from identifiers, perhaps we should inject a (temporary) meta front matter potion to store the file number. Edit: Nevermind we can't do this, as it means we lose the source file reference, unless we add another real path identifier which feels double hacky. Edit 2: Yeah we should not mess with identifiers, instead we need to transform the output path since that's the only time we want it to be clean (so we don't have the numbers in compiled files) so this needs to be done at the route key stage. Edit 3: Route key stage option might be better as well since it means we can diff out the number instead of a hacky meta field |
fa84383
to
b2ca812
Compare
Allows Copilot to better generate tests, we will move these back to the test later
8f96f11
to
b87eee1
Compare
See #1709 (comment) (edit 2 and 3)
Not allowed when using flattened output paths
fd01205
to
2f82b49
Compare
This should generally have the same semantics, however, it allows us to use the numbering prefix normalization provided by #1709
7141075
to
8c181f2
Compare
ChatGPT Syntax Response
In static site generators and flat-file content management systems, page order within filenames is often specified using numeric prefixes or timestamps. Here are some common approaches:
The choice depends on personal preference, project requirements, and the features supported by the specific static site generator or CMS being used.
Various syntaxes can be used for the numeric prefix option in static site generators and flat-file CMSs. Here are some common syntaxes:
|
Additionally, when asked about a possible configuration option name (and providing the base hyde config for context) this is the suggestion Given the current code style and the nature of the configuration options, a suitable name for the configuration option to disable the feature of supporting multiple formats for specifying page order could be: /*
|--------------------------------------------------------------------------
| Filename Ordering
|--------------------------------------------------------------------------
|
| This setting controls the ordering of filenames used for specifying page
| order within the static site generator. By default, multiple formats
| are supported (e.g., '00X_file.md' and 'X_file.md'). You can disable
| support for multiple formats by setting this option to false.
|
*/
'filename_ordering' => true, This naming convention follows the pattern used in the existing configuration file, providing a clear and descriptive name for the option along with a brief explanation of its purpose and behavior. |
AI Documentation DraftsPrompt
(ChatGPT)Filename Prefix Navigation OrderingIntroductionHydePHP v2 introduces a new feature that allows you to order pages in the navigation menus by prefixing a number to the filenames. This feature provides a convenient way to control the order of pages without the need for explicit priority settings in the front matter or configuration files. Enabling the FeatureThe filename prefix navigation ordering feature is enabled by default in HydePHP v2. However, if you need to disable it for any reason, you can do so in the configuration file. To disable the filename prefix navigation ordering feature, set the 'filename_page_ordering' => false, Ordering PagesFlat NavigationIn a flat navigation structure where all pages are at the same level, you can simply prefix each filename with a number to specify the order in which they should appear in the navigation menu. For example:
In this case, the pages will appear in the navigation menu in the order specified by the numerical prefixes. Grouped NavigationIf your pages are organized into groups or subdirectories, you can still use filename prefix ordering within each group independently. For example:
In this scenario, the pages within the "api" group will be ordered independently of the pages outside the group. ConclusionThe filename prefix navigation ordering feature in HydePHP v2 offers a flexible and intuitive way to organize the navigation menus of your website or documentation project. By simply prefixing filenames with numbers, you can control the order of pages without the need for complex configuration settings. (GPT-3.5-Turbo)Numerical Prefix Navigation OrderingHydePHP v2 introduces a new feature that allows navigation items to be ordered based on a numerical prefix in the filename. This feature provides a simple and efficient way to control the ordering of pages in both the primary navigation menu and the documentation sidebar. Enabling the FeatureTo enable the numerical prefix navigation ordering feature, simply include a numerical prefix followed by a hyphen in the filenames of your pages. The numerical prefix will determine the order of the pages in the navigation menus. Ordering PagesThe numerical prefix is used to order pages in ascending order. Lower numerical prefixes will place the pages higher up in the navigation menus. You can use any integer value as the prefix, and pages without a prefix will default to the end of the menu. ExamplesHere are some examples to illustrate how the numerical prefix navigation ordering works:
Grouping PagesYou can also use numerical prefixes to group pages together. Pages with the same numerical prefix will be grouped together in the navigation menus, allowing for a more organized and structured menu. CustomizationWhile numerical prefixes provide a convenient way to order pages, you can still customize the order of individual pages using the By utilizing numerical prefixes in your page filenames, you can easily control the ordering of pages in your navigation menus, making it easier to create a cohesive and user-friendly website structure. (GPT-4-Turbo)Numerical Prefix Navigation OrderingHydePHP v2 introduces a convenient way to control the order of pages by allowing you to prefix filenames with numbers. This simple numbering scheme determines the position of pages within navigation menus, ensuring a custom sequential layout without additional configurations. Enabling and Understanding the FeatureThis feature is enabled by default. To order your pages, prefix the filenames with numbers followed by a hyphen. For example:
The navigation system interprets the numbers to sort the pages accordingly. Lower numbers result in earlier positions within the menu. Benefits of Using Numerical PrefixesUsing numerical prefixes helps in organizing the content structurally without diving into configuration files for manual ordering. It's particularly useful for:
Grouped and Nested NavigationWhen using numerical prefixes within grouped or nested directories, each group can maintain its own independent numbering. For instance:
Each group ( Overriding Numerical OrderIf you need to override the order specified by filenames temporarily or permanently, you can use the Limitations and Considerations
Practical Usage in a Site StructureConsider a documentation site with various sections including installation guides, user manuals, and FAQs. Numerical prefixes can directly manage the flow and display of these sections to visitors, minimizing backend management overhead. This powerful yet straightforward feature enhances HydePHP v2's capability to manage large amounts of content efficiently, reinforcing its utility in building well-structured, navigable websites. |
Fixes #1646