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

[2.x] Unify the Navigation API #1818

Merged
merged 254 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
8d5bc2d
Merge branch '2.x-dev' into unify-the-navigation-api
caendesilva Jul 10, 2024
17cd699
Merge branch '2.x-dev' into unify-the-navigation-api
caendesilva Jul 10, 2024
5e27628
Add configuration helper to the Navigation facade to create item array
caendesilva Jul 10, 2024
7733c69
Remove test method type annotations
caendesilva Jul 10, 2024
4c99f02
Test item method with URL
caendesilva Jul 10, 2024
598df29
Prepare generator for configuration type change
caendesilva Jul 10, 2024
ebb7038
Test covers the navigation facade
caendesilva Jul 10, 2024
6d43954
Merge branch '2.x-dev' into unify-the-navigation-api
caendesilva Jul 10, 2024
7fcd967
Remove temporary refactor code
caendesilva Jul 10, 2024
ab6e659
Revert "Remove temporary refactor code"
caendesilva Jul 10, 2024
b22c311
Revert "Prepare generator for configuration type change"
caendesilva Jul 10, 2024
7188b38
Breaking: The custom navigation item config now uses array inputs
caendesilva Jul 10, 2024
8142e7f
Update Yaml configuration loader to parse navigation items
caendesilva Jul 10, 2024
af20160
Loader must create array structures as routes are not available yet
caendesilva Jul 10, 2024
01f3630
Clean up code
caendesilva Jul 10, 2024
0724ac0
Test navigation items in the YAML config can be resolved to routes
caendesilva Jul 10, 2024
600dfd5
Add null fallbacks
caendesilva Jul 10, 2024
9af37e1
Rethrow exceptions more helpfully
caendesilva Jul 10, 2024
4e1fbf9
Reorder tests
caendesilva Jul 10, 2024
44573dd
Mark method as experimental
caendesilva Jul 10, 2024
74240c0
Update type annotation to match actual values
caendesilva Jul 10, 2024
a6c5ba0
Test extra YAML navigation item fields are ignored
caendesilva Jul 10, 2024
c773393
Revert "Test extra YAML navigation item fields are ignored"
caendesilva Jul 10, 2024
efea4a4
Test adding extra YAML navigation item fields throws an exception
caendesilva Jul 10, 2024
acb740d
Unpack the array directly
caendesilva Jul 10, 2024
cc0f567
Clean up if a test failed to clean up after itself
caendesilva Jul 10, 2024
709bc35
Update navigation item configuration to use the new facade
caendesilva Jul 10, 2024
c06a475
Breaking: Rename `subdirectories` option to `subdirectory_display`
caendesilva Jul 10, 2024
a8d175c
Merge branch '2.x-dev' into unify-the-navigation-api
caendesilva Jul 10, 2024
ba547bd
Test the entire component state
caendesilva Jul 10, 2024
5d7fb5e
Add attributes array to the navigation item class
caendesilva Jul 10, 2024
b07ecf5
Annotate scalar array generics
caendesilva Jul 10, 2024
9762449
Add attributes accessor
caendesilva Jul 10, 2024
6c5961b
Return attributes as component attribute bag
caendesilva Jul 10, 2024
15b97f9
Revert "Return attributes as component attribute bag"
caendesilva Jul 10, 2024
66dc9b2
Rename accessor to signify it's for extra attributes
caendesilva Jul 10, 2024
caae636
Annotate the scalar return array
caendesilva Jul 10, 2024
283016f
Merge in the extra attributes
caendesilva Jul 10, 2024
93cef20
Change merge order to preserve output format
caendesilva Jul 10, 2024
395dbfb
Merge in extra attributes last in component
caendesilva Jul 10, 2024
b558720
Update RelativeLinksAcrossPagesRetainsIntegrityTest.php
caendesilva Jul 10, 2024
9c60087
Revert "Update RelativeLinksAcrossPagesRetainsIntegrityTest.php"
caendesilva Jul 10, 2024
c087bbf
Revert "Merge in extra attributes last in component"
caendesilva Jul 10, 2024
33e40d8
Update navigation item facade to support the attribute parameter
caendesilva Jul 10, 2024
1beec7e
Update the make method to support extra attributes
caendesilva Jul 10, 2024
8080709
Update the constructors to support extra attributes
caendesilva Jul 10, 2024
8b6d678
Generate attribute accessors
caendesilva Jul 10, 2024
17a33e0
Revert "Generate attribute accessors"
caendesilva Jul 10, 2024
3f7c34b
Test the view with extra attributes
caendesilva Jul 10, 2024
798d363
Annotate the return array shape
caendesilva Jul 10, 2024
ed615a7
Update YAML parser array shapes
caendesilva Jul 10, 2024
5731738
Support setting navigation items with extra attributes in the config
caendesilva Jul 10, 2024
09db9f1
Annotate the parameter array shape
caendesilva Jul 10, 2024
c8a72a8
Use variable annotation for cleaner looking code
caendesilva Jul 10, 2024
c6cdbab
Test invalid custom navigation configuration throws exception
caendesilva Jul 10, 2024
b0bbfa7
Unpack the array directly
caendesilva Jul 10, 2024
87bb7ef
Introduce local variable
caendesilva Jul 10, 2024
ca28299
Catch and rethrow error caused by bad configuration
caendesilva Jul 10, 2024
3f2878a
Normalize to more generic error message
caendesilva Jul 10, 2024
5ed1082
Add helpers to assert exception was thrown
caendesilva Jul 10, 2024
138e4b9
Add message to custom assertion
caendesilva Jul 10, 2024
6a076b8
Let the generator parse navigation items instead of the loader
caendesilva Jul 10, 2024
997a6ee
Rename closure parameter
caendesilva Jul 10, 2024
912f7b2
Extract experimental helper method to try parsing config values
caendesilva Jul 10, 2024
b0ec950
Merge pull request #1824 from hydephp/support-extra-attributes-for-na…
caendesilva Jul 11, 2024
e966f09
Merge branch '2.x-dev' into unify-the-navigation-api
caendesilva Jul 11, 2024
fabaf29
Draft builder method
caendesilva Jul 11, 2024
7c89668
Draft method documentation
caendesilva Jul 11, 2024
7f395d9
Rename added builder method to define
caendesilva Jul 11, 2024
5415a91
Rename added builder method to configure
caendesilva Jul 11, 2024
2cbe18d
Create NavigationMenuConfigurationBuilder.php
caendesilva Jul 11, 2024
519ee26
Draft the class documentation
caendesilva Jul 11, 2024
58f9b77
Return new navigation menu configuration builder
caendesilva Jul 11, 2024
9ae9d66
Add protected config array
caendesilva Jul 11, 2024
4446fd1
Class NavigationMenuConfigurationBuilder extends ArrayObject
caendesilva Jul 11, 2024
a456ff0
Class NavigationMenuConfigurationBuilder implements Arrayable
caendesilva Jul 11, 2024
15abd0c
Implement toArray() method
caendesilva Jul 11, 2024
01080dd
Draft the builder methods
caendesilva Jul 11, 2024
1487cab
Add method descriptions
caendesilva Jul 11, 2024
51ea211
Annotate fluent method return
caendesilva Jul 11, 2024
9ddc7ae
Prepare parameter annotations
caendesilva Jul 11, 2024
87936de
Annotate the parameter generics and enumerated types
caendesilva Jul 11, 2024
5328cf7
Move down the toArray method
caendesilva Jul 11, 2024
118eb17
Implement the builder methods
caendesilva Jul 11, 2024
283852a
Create NavigationMenuConfigurationBuilderTest.php
caendesilva Jul 11, 2024
5a48d0a
Generate unit test with Claude
caendesilva Jul 11, 2024
289ef29
Test the added facade method
caendesilva Jul 11, 2024
073faa7
Skip test for not implemented feature
caendesilva Jul 11, 2024
121159f
Construct with the config property
caendesilva Jul 11, 2024
374c529
Construct with array object flags
caendesilva Jul 11, 2024
5118abe
Revert "Construct with array object flags"
caendesilva Jul 11, 2024
6c60b5d
Revert "Construct with the config property"
caendesilva Jul 11, 2024
ee6eac0
Fix typo in description
caendesilva Jul 11, 2024
413c12c
Fix typo in description
caendesilva Jul 11, 2024
aff2511
Refactor the class to property utilise the array object features
caendesilva Jul 11, 2024
97bb4f9
Replace qualifier with an import
caendesilva Jul 11, 2024
599abdc
Document the array shape returns
caendesilva Jul 11, 2024
b5cc7ed
Use assert same for scalar comparisons
caendesilva Jul 11, 2024
1029dc1
Apply fixes from StyleCI
StyleCIBot Jul 11, 2024
7e9681e
Remove unnecessary comment
caendesilva Jul 11, 2024
6432901
Split out assertion to dedicated test method
caendesilva Jul 11, 2024
9c1afcf
Revert "Skip test for not implemented feature"
caendesilva Jul 11, 2024
2842aeb
Assert the enumerated string type
caendesilva Jul 11, 2024
bd35954
Replace internal marker for already internal method with experimental
caendesilva Jul 11, 2024
d0c9c1c
Improve the configuration method documentation
caendesilva Jul 11, 2024
80ae091
Test can configure main menu using array settings
caendesilva Jul 11, 2024
de4e8c3
Test can configure main menu using builder settings
caendesilva Jul 11, 2024
ea05a98
Inline local variable
caendesilva Jul 11, 2024
57b7035
Use the new Navigation configuration builder class
caendesilva Jul 11, 2024
8588cb9
Rename builder methods to be self describing
caendesilva Jul 11, 2024
93497a4
Remove now redundant code comments
caendesilva Jul 11, 2024
e7b5a1c
Remove infix from helper method name
caendesilva Jul 11, 2024
491d08e
Clean up formatting
caendesilva Jul 11, 2024
7641ff9
Clarify comment
caendesilva Jul 11, 2024
e48da59
Document default value
caendesilva Jul 11, 2024
7f9f9b7
Add experimental fluent shorthand
caendesilva Jul 11, 2024
a961afe
Update experimental marker
caendesilva Jul 11, 2024
d5f2439
Link to facade method and normalize documentation
caendesilva Jul 11, 2024
3f92d37
Merge pull request #1827 from hydephp/navigation-config-builder-class
caendesilva Jul 11, 2024
210271f
Remove documentation for alternate front matter properties
caendesilva Jul 11, 2024
a6fa295
Merge long parts of introduction to a single section
caendesilva Jul 11, 2024
f72a4f5
Update the menu types list text
caendesilva Jul 11, 2024
d98f73b
Merge together sections in the introduction
caendesilva Jul 11, 2024
49fb29c
Improve headings
caendesilva Jul 11, 2024
70993a5
Merge internal structure section to be more concise and clear
caendesilva Jul 11, 2024
e2a6934
Improve the wording of the priorities section
caendesilva Jul 11, 2024
5b56922
Reword introduction to be more concise
caendesilva Jul 11, 2024
a7abfba
Reword list to be more concise
caendesilva Jul 11, 2024
a9ff6f3
Reword introduction to be more concise
caendesilva Jul 11, 2024
cfbc1b1
Rewrite section to use an easier to read list
caendesilva Jul 11, 2024
528b4fc
Remove extra newlines
caendesilva Jul 11, 2024
1d89539
Move down part not needed in introduction to bottom of the section
caendesilva Jul 11, 2024
a641570
Reword list to be more concise
caendesilva Jul 11, 2024
f8b56aa
Remove redundant information from section introductions
caendesilva Jul 11, 2024
0bd1377
Document default data sources
caendesilva Jul 11, 2024
059f1c6
Add tip about alternate syntax
caendesilva Jul 11, 2024
f437ba2
Reword section to be more concise
caendesilva Jul 11, 2024
9d6a517
Add note about grouping normalization
caendesilva Jul 11, 2024
cb24a79
Update introduction to allow for section to stand alone
caendesilva Jul 11, 2024
b4541d2
Expand abbreviation
caendesilva Jul 11, 2024
f3e1195
Clean up the section to be easier and clearer to read
caendesilva Jul 11, 2024
d021aca
Update headings to be more concise
caendesilva Jul 11, 2024
a282b9c
Update heading to be more concise
caendesilva Jul 11, 2024
143eb6d
Update sentence to be more concise
caendesilva Jul 11, 2024
12c055c
Rewrite introduction to be more fluent
caendesilva Jul 11, 2024
eed07c3
Remove unnecessary qualifiers from examples
caendesilva Jul 11, 2024
58e4ed0
Document explicitness in introduction instead in the examples
caendesilva Jul 11, 2024
6eb7084
Remove extra lines from file path labels
caendesilva Jul 11, 2024
ecbbee3
Clean up section
caendesilva Jul 11, 2024
2385ac0
Update heading to be more concise
caendesilva Jul 11, 2024
b17bfe1
Normalize file path syntax
caendesilva Jul 11, 2024
1e32a89
Remove introductory line offering no real information
caendesilva Jul 11, 2024
83bccae
Revert "Remove introductory line offering no real information"
caendesilva Jul 11, 2024
aaeff4b
Clean up introduction
caendesilva Jul 11, 2024
984a02d
Rewrite section to be more fluent
caendesilva Jul 11, 2024
0f925e1
Simplify custom navigation link section introduction
caendesilva Jul 11, 2024
13c5ef4
Update custom navigation links example to use new facade method
caendesilva Jul 11, 2024
c186ae0
Add tip on named arguments
caendesilva Jul 11, 2024
b2f2057
Remove rendered HTML example
caendesilva Jul 11, 2024
6ebd643
Normalize heading
caendesilva Jul 11, 2024
7c2f90c
Improve the subdirectory display section
caendesilva Jul 11, 2024
cc01ba3
Normalize heading
caendesilva Jul 11, 2024
03262ef
Clean up the subdirectory grouping documentation
caendesilva Jul 11, 2024
2d1b205
Clean up the Navigation API section to be more concise
caendesilva Jul 11, 2024
5c1b73f
Shorten the introduction to be more concise
caendesilva Jul 11, 2024
cfffe1d
Improve information presented in example introduction
caendesilva Jul 11, 2024
f353b37
Remove unnecessary information from example
caendesilva Jul 11, 2024
2ff20cd
Merge in prefix stripping information into line
caendesilva Jul 11, 2024
3e6b3b0
Rename heading
caendesilva Jul 11, 2024
f7e71fd
Remove introduction containing discouraged usage
caendesilva Jul 11, 2024
f18507f
Remove extra newline
caendesilva Jul 11, 2024
ee0e57f
Use more concise language
caendesilva Jul 11, 2024
23ff410
Normalize heading
caendesilva Jul 11, 2024
a505a0b
Use more concise wording
caendesilva Jul 11, 2024
a32354c
Use more concise wording
caendesilva Jul 11, 2024
995bd81
Update section to be more concise
caendesilva Jul 11, 2024
23e610d
Remove section detailing discouraged use with no real benefit
caendesilva Jul 11, 2024
e8639f4
Reword section introduction
caendesilva Jul 11, 2024
f0e2ff3
Normalize file path label syntax
caendesilva Jul 11, 2024
14e5c4c
Normalize heading formatting
caendesilva Jul 11, 2024
519002a
Remove newline
caendesilva Jul 11, 2024
bd2f05a
Merge introduction sections
caendesilva Jul 11, 2024
9206cf4
Add subheading
caendesilva Jul 11, 2024
17bf95f
Reword and summarize parts of the internals overview
caendesilva Jul 11, 2024
b47bae0
Link to the related class
caendesilva Jul 11, 2024
c363a81
Merge pull request #1828 from hydephp/clean-up-the-navigation-documen…
caendesilva Jul 12, 2024
e3c058a
Merge branch '2.x-dev' into unify-the-navigation-api
caendesilva Jul 12, 2024
896aeb7
Merge branch '2.x-dev' into unify-the-navigation-api
caendesilva Jul 12, 2024
9267dfe
Merge branch '2.x-dev' into unify-the-navigation-api
caendesilva Jul 12, 2024
901b810
Create Claude draft
caendesilva Jul 12, 2024
d51c4af
Revert "Create Claude draft"
caendesilva Jul 12, 2024
3f9f9f8
Remove hard line breaks from sections
caendesilva Jul 12, 2024
7a85697
Remove extra newlines
caendesilva Jul 12, 2024
467b991
Cleanup line
caendesilva Jul 12, 2024
ac511db
Shorten line
caendesilva Jul 12, 2024
d4836ee
Merge branch '2.x-dev' into unify-the-navigation-api
caendesilva Jul 12, 2024
5f1e3e7
Merge branch 'unify-the-navigation-api' into clean-up-the-navigation-…
caendesilva Jul 12, 2024
51dc2ed
Remove hard line breaks from sections
caendesilva Jul 12, 2024
326898b
Merge branch 'unify-the-navigation-api' into clean-up-the-navigation-…
caendesilva Jul 12, 2024
accc2f7
Clarify that lower priority values result in higher placement in the …
caendesilva Jul 12, 2024
cc0d2e3
Clean up section
caendesilva Jul 12, 2024
0df917b
Reformat table
caendesilva Jul 12, 2024
ab46ba4
Clarify that label is generated not literal
caendesilva Jul 12, 2024
ad504ac
Improve grouping documentation wording
caendesilva Jul 12, 2024
5aa2fa5
Fix wrong term used for sidebars
caendesilva Jul 12, 2024
cff03ac
Improve wording to be clearer
caendesilva Jul 12, 2024
c3fe8fb
Remove unnecessary line break
caendesilva Jul 12, 2024
9a2b2ef
Fix punctuation
caendesilva Jul 12, 2024
a7c6f8f
Clarify wording
caendesilva Jul 12, 2024
87eec33
Fix section order
caendesilva Jul 12, 2024
3fb32ab
Fix inline code formatting
caendesilva Jul 12, 2024
79ef5b2
Fix wrong page type name
caendesilva Jul 12, 2024
591ae52
Fix grammar
caendesilva Jul 12, 2024
a2bc307
Merge branch '2.x-dev' into clean-up-the-navigation-documentation
caendesilva Jul 12, 2024
3d3932d
Remove word that isn't to be there
caendesilva Jul 12, 2024
3f5a4dd
Add missing important word
caendesilva Jul 12, 2024
4b5c86d
Use American English
caendesilva Jul 12, 2024
f3c494e
Split out subordinate clause to separate sentence
caendesilva Jul 12, 2024
dc69f6a
Use APA style headings
caendesilva Jul 12, 2024
7021d23
Fix clarity
caendesilva Jul 12, 2024
1eb578c
Fix title formatting
caendesilva Jul 12, 2024
14c5ac6
Use shorter synonym
caendesilva Jul 12, 2024
18fafba
Remove comma from coupled clauses
caendesilva Jul 12, 2024
fcc030d
Reword line to be more fluent
caendesilva Jul 12, 2024
82aba3d
Merge branch '2.x-dev' into clean-up-the-navigation-documentation
caendesilva Jul 12, 2024
072dd83
Merge branch '2.x-dev' into clean-up-the-navigation-documentation
caendesilva Jul 12, 2024
714e941
Use plural wording to match other pluralized terms in sentence
caendesilva Jul 12, 2024
1bea0ef
Add missing infix
caendesilva Jul 12, 2024
d269f6a
Add comma between independent clauses
caendesilva Jul 12, 2024
74c4924
Fix typo should be a comma
caendesilva Jul 12, 2024
c00ab1b
Add missing word
caendesilva Jul 12, 2024
8129241
Remove comma from coupled clauses
caendesilva Jul 12, 2024
312135e
Change word order to be more fluent
caendesilva Jul 12, 2024
e46b837
Split out coupled clause to standalone sentence
caendesilva Jul 12, 2024
a5df67f
Reword to pluralize feature in introduction
caendesilva Jul 12, 2024
d44d2a3
Merge branch '2.x-dev' into unify-the-navigation-api
caendesilva Jul 12, 2024
89fe3e0
Merge branch 'unify-the-navigation-api' into clean-up-the-navigation-…
caendesilva Jul 12, 2024
51edfbe
Merge pull request #1838 from hydephp/clean-up-the-navigation-documen…
caendesilva Jul 12, 2024
5a5d36d
Move the sidebar documentation to the documentation pages page
caendesilva Jul 12, 2024
8427e55
Add lost section
caendesilva Jul 12, 2024
68f3d33
Remove documentation for syntax with no benefit
caendesilva Jul 12, 2024
8d06b5e
Normalize spelling
caendesilva Jul 12, 2024
c2dcb0f
Restructure and improve the documentation
caendesilva Jul 12, 2024
358bfcc
Improve priority setting
caendesilva Jul 12, 2024
2d5edf6
Add todo
caendesilva Jul 12, 2024
c802a5a
Merge branch 'unify-the-navigation-api' into clean-up-the-navigation-…
caendesilva Jul 12, 2024
f7870ad
Merge pull request #1841 from hydephp/clean-up-the-navigation-documen…
caendesilva Jul 12, 2024
3cbc864
Update RELEASE_NOTES.md
caendesilva Jul 12, 2024
a313579
Update RELEASE_NOTES.md
caendesilva Jul 12, 2024
e2cdca6
Update RELEASE_NOTES.md
caendesilva Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ This serves two purposes:
- Added a new `\Hyde\Framework\Exceptions\ParseException` exception class to handle parsing exceptions in data collection files in https://github.com/hydephp/develop/pull/1732
- Added a new `\Hyde\Framework\Exceptions\InvalidConfigurationException` exception class to handle invalid configuration exceptions in https://github.com/hydephp/develop/pull/1799
- The `\Hyde\Facades\Features` class is no longer marked as internal, and is now thus part of the public API.
- Added support for setting custom navigation items in the YAML configuration in https://github.com/hydephp/develop/pull/1818
- Added support for setting extra attributes for navigation items in https://github.com/hydephp/develop/pull/1824
- Introduced a new navigation config builder class to simplify navigation configuration in https://github.com/hydephp/develop/pull/1827

### Changed
- **Breaking:** The internals of the navigation system has been rewritten into a new Navigation API. This change is breaking for custom navigation implementations. For more information, see below.
Expand All @@ -23,6 +26,8 @@ This serves two purposes:
- **Breaking:** The `hyde.authors` config setting should now be keyed by the usernames. For more information, see below.
- **Breaking:** The `Author::create()` method now returns an array instead of a `PostAuthor` instance. For more information, see below.
- **Breaking:** The `Author::get()` method now returns `null` if an author is not found, rather than creating a new instance. For more information, see below.
- **Breaking:** The custom navigation item configuration now uses array inputs instead of the previous format. For more information, see the upgrade guide below.
- **Breaking:** Renamed the `hyde.navigation.subdirectories` configuration option to `hyde.navigation.subdirectory_display`.
- Medium: The `route` function will now throw a `RouteNotFoundException` if the route does not exist in https://github.com/hydephp/develop/pull/1741
- Minor: Navigation menu items are now no longer filtered by duplicates (meaning two items with the same label can now exist in the same menu) in https://github.com/hydephp/develop/pull/1573
- Minor: Due to changes in the navigation system, it is possible that existing configuration files will need to be adjusted in order for menus to look the same (in terms of ordering etc.)
Expand All @@ -43,6 +48,8 @@ This serves two purposes:
- Calling the `DataCollection` methods will no longer create the data collections directory in https://github.com/hydephp/develop/pull/1732
- Markdown includes are now converted to HTML using the custom HydePHP Markdown service, meaning they now support full GFM spec and custom Hyde features like colored blockquotes and code block filepath labels in https://github.com/hydephp/develop/pull/1738
- Markdown returned from includes are now trimmed of trailing whitespace and newlines in https://github.com/hydephp/develop/pull/1738
- Reorganized and cleaned up the navigation and sidebar documentation for improved clarity.
- Moved the sidebar documentation to the documentation pages section for better organization.

### Deprecated
- for soon-to-be removed features.
Expand Down Expand Up @@ -333,3 +340,78 @@ For example, an empty or malformed JSON file will now throw an exception like th

In order to normalize the thrown exceptions, we now rethrow the `ParseException` from `Symfony/Yaml` as our custom `ParseException` to match the JSON and Markdown validation.
Additionally, an exception will be thrown if a data file is empty, as this is unlikely to be intentional. Markdown files can have an empty body if front matter is present.

## New features

<!-- Editors note: Todo: Maybe move to the relevant docs... -->

### Navigation configuration changes

The custom navigation item configuration format has been updated to use array inputs. This change allows for more flexibility and consistency in defining navigation items.

#### Old format:

```php
'navigation' => [
'custom_items' => [
'Custom Item' => '/custom-page',
],
],
```

#### New format:

```php
'navigation' => [
'custom_items' => [
['label' => 'Custom Item', 'destination' => '/custom-page'],
],
],
```

Additionally, the `hyde.navigation.subdirectories` configuration option has been renamed to `hyde.navigation.subdirectory_display`. Update your configuration files accordingly.

### YAML configuration for navigation items

You can now set custom navigation items directly in your YAML configuration files. This provides an alternative to defining them in the PHP configuration files.

Example:

```yaml
navigation:
custom_items:
- label: Custom Item
destination: /custom-page
```

### Extra attributes for navigation items

Navigation items now support extra attributes, allowing you to add custom data or styling to your navigation elements. You can set these attributes in both PHP and YAML configurations.

Example in PHP:

```php
'navigation' => [
'custom_items' => [
[
'label' => 'Custom Item',
'destination' => '/custom-page',
'attributes' => ['class' => 'special-link', 'target' => '_blank'],
],
],
],
```

Example in YAML:

```yaml
navigation:
custom_items:
- label: Custom Item
destination: /custom-page
attributes:
class: special-link
target: _blank
```

These changes provide more flexibility and control over your site's navigation structure. Make sure to update your configuration files and any custom code that interacts with navigation items to align with these new formats and features.
1 change: 1 addition & 0 deletions app/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
'Features' => \Hyde\Facades\Features::class,
'Config' => \Hyde\Facades\Config::class,
'Filesystem' => \Hyde\Facades\Filesystem::class,
'Navigation' => \Hyde\Facades\Navigation::class,
'Routes' => \Hyde\Foundation\Facades\Routes::class,
'HtmlPage' => \Hyde\Pages\HtmlPage::class,
'BladePage' => \Hyde\Pages\BladePage::class,
Expand Down
40 changes: 12 additions & 28 deletions config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Hyde\Facades\Author;
use Hyde\Facades\Meta;
use Hyde\Enums\Feature;
use Hyde\Facades\Navigation;

return [

Expand Down Expand Up @@ -331,40 +332,23 @@
|
*/

'navigation' => [
// This configuration sets the priorities used to determine the order of the menu.
// The default values have been added below for reference and easy editing.
// The array key is the page's route key, the value is the priority.
// Lower values show up first in the menu. The default is 999.
'order' => [
'navigation' => Navigation::configure()
->setPagePriorities([
'index' => 0,
'posts' => 10,
'docs/index' => 100,
],

// In case you want to customize the labels for the menu items, you can do so here.
// Simply add the route key as the array key, and the label as the value.
'labels' => [
])
->setPageLabels([
'index' => 'Home',
'docs/index' => 'Docs',
],

// These are the route keys of pages that should not show up in the navigation menu.
'exclude' => [
])
->excludePages([
'404',
],

// Any extra links you want to add to the navigation menu can be added here.
// To get started quickly, you can uncomment the defaults here.
// See the documentation link above for more information.
'custom' => [
// NavigationItem::create('https://github.com/hydephp/hyde', 'GitHub', 200),
],

// How should pages in subdirectories be displayed in the menu?
// You can choose between 'dropdown', 'flat', and 'hidden'.
'subdirectories' => 'hidden',
],
])
->addNavigationItems([
// Navigation::item('https://github.com/hydephp/hyde', 'GitHub', 200),
])
->setSubdirectoryDisplayMode('hidden'),

/*
|--------------------------------------------------------------------------
Expand Down
Loading