You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: RELEASE_NOTES.md
+43-11Lines changed: 43 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,8 @@ This serves two purposes:
21
21
-**Breaking:** The `hyde.features` configuration format has changed to use Enums instead of static method calls. For more information, see below.
22
22
-**Breaking:** Renamed class `DataCollections` to `DataCollection`. For more information, see below.
23
23
-**Breaking:** The `hyde.authors` config setting should now be keyed by the usernames. For more information, see below.
24
+
-**Breaking:** The `Author::create()` method now returns an array instead of a `PostAuthor` instance. For more information, see below.
25
+
-**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.
24
26
- Medium: The `route` function will now throw a `RouteNotFoundException` if the route does not exist in https://github.com/hydephp/develop/pull/1741
25
27
- 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
26
28
- 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.)
@@ -152,20 +154,50 @@ Of course, if you have disabled any of the features, do not include them in the
152
154
153
155
### Post Author changes
154
156
155
-
This release makes major improvements into the usability and design of the blog post author feature.
157
+
This release makes major improvements to the usability and design of the blog post author feature.
156
158
157
159
Here is the full list of changes:
158
160
159
-
- Breaking: The `hyde.authors` config setting should now be keyed by the usernames
160
-
- Removed: The deprecated `PostAuthor::getName()` method is now removed (use `$author->name`)
161
-
- Feature: We now support setting authors in the YAML configuration! Fixes `#1719`
162
-
- Feature: Added a `$author->getPosts()` method to get all author's posts
163
-
- Feature: Authors now can also have custom biographies and social media links
164
-
- The PostAuthor class is now Arrayable and JsonSerializable
165
-
- The collection of site authors are now stored in the HydeKernel
166
-
- Authors can additionally be accessed through `Hyde::authors()`
167
-
168
-
For more information, see https://github.com/hydephp/develop/pull/1782
161
+
- Breaking: The `hyde.authors` config setting must now be keyed by the usernames, instead of providing the username in the author facade constructor.
162
+
- Breaking: The `Author::create()` method now returns an array instead of a `PostAuthor` instance. This only affects custom code that uses the `Author` facade.
163
+
- Breaking: The `Author::get()` method now returns `null` if an author is not found, rather than creating a new instance. This only affects custom code that uses the `Author` facade.
164
+
- Removed: The deprecated `PostAuthor::getName()` method has been removed (use `$author->name` instead).
165
+
- Changed: Author usernames are now automatically normalized (converted to lowercase and spaces replaced with underscores in order to ensure URL routability).
166
+
- Changed: If an author display name is not provided, it is now intelligently generated from the username.
167
+
- Feature: Authors can now be set in the YAML configuration.
168
+
- Feature: Added a `$author->getPosts()` method to get all of an author's posts.
169
+
- Feature: Authors now support custom biographies, avatars, and social media links. Note that these are not currently used in any of the default templates, but you can use them in your custom views.
170
+
- The collection of site authors is now stored in the HydeKernel, meaning authors can be accessed through `Hyde::authors()`.
171
+
- The `PostAuthor` class is now Arrayable and JsonSerializable.
172
+
173
+
#### Upgrade guide:
174
+
175
+
1. Update your `config/hyde.php` file to use the new author configuration format:
176
+
```php
177
+
'authors' => [
178
+
'username' => Author::create(
179
+
name: 'Display Name',
180
+
website: 'https://example.com',
181
+
bio: 'Author bio',
182
+
avatar: 'avatar.png',
183
+
socials: ['twitter' => '@username']
184
+
),
185
+
],
186
+
```
187
+
188
+
2. Review and update any code that uses the `Author` facade:
189
+
- The `create()` method now returns an array instead of a `PostAuthor` instance.
190
+
- The `get()` method may return `null`, so handle this case in your code.
191
+
192
+
3. Check your blog post front matter and ensure that `author` fields match the new username keys in your configuration.
193
+
194
+
4. If you have custom templates that use author data, update them to:
195
+
- Optional: Feel free to use the new available fields: `bio`, `avatar`, and `socials`.
196
+
- Account for usernames now being lowercase with underscores which may lead to changed HTML or URL paths.
197
+
198
+
5. If you were relying on `Author::get()` to create new authors on the fly, update your code to handle `null` returns or create authors explicitly.
199
+
200
+
For more information, see https://github.com/hydephp/develop/pull/1782 and https://github.com/hydephp/develop/pull/1798
Copy file name to clipboardExpand all lines: docs/digging-deeper/customization.md
+43-8Lines changed: 43 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,21 +124,32 @@ Here are the default settings:
124
124
125
125
### Authors
126
126
127
-
Hyde has support for adding authors in front matter, for example to automatically add a link to your website or social media profiles.
128
-
However, it's tedious to have to add those to each and every post you make, and keeping them updated is even harder.
127
+
Hyde supports adding authors to blog posts, allowing you to automatically include information like display names and website links.
128
+
We even support fields for avatars, biographies, and social media profiles, which you can use in your custom Blade templates.
129
129
130
+
While you can set all this data directly in the [front matter](blog-posts#author), that quickly becomes tedious and hard to maintain.
130
131
Instead, you can predefine authors in the Hyde config. When writing posts, just specify the username in the front matter,
131
132
and the rest of the data will be pulled from a matching entry found in the configuration file.
132
133
133
-
#### Example
134
+
#### Configuration
135
+
136
+
Authors are defined in the `config/hyde.php` file under the `authors` key. Each author is keyed by their username and is configured using the `Author::create()` method:
// The following fields, along with the username, are used by the default blog post templates.
143
+
name: 'Mr. Hyde',
144
+
website: 'https://hydephp.com',
145
+
146
+
// These fields are not currently used in the default templates, but you can use them in your custom views.
147
+
bio: 'The mysterious author of HydePHP',
148
+
avatar: 'avatar.png',
149
+
socials: [
150
+
'twitter' => '@HydeFramework',
151
+
'github' => 'hydephp',
152
+
],
142
153
),
143
154
],
144
155
```
@@ -150,14 +161,38 @@ author:
150
161
username: mr_hyde
151
162
name: Mr. Hyde
152
163
website: https://hydephp.com
164
+
bio: The mysterious author of HydePHP
165
+
avatar: avatar.png
166
+
socials:
167
+
twitter: "@HydeFramework"
168
+
github: hydephp
153
169
```
154
170
155
-
But you only have to specify the username:
171
+
But you only have to specify the username to get all the other data.
156
172
157
173
```yaml
158
174
author: mr_hyde
159
175
```
160
176
177
+
If you want to override the data for a specific post, you can do so in the [front matter](blog-posts#author) which is great for guest authors or one-off posts.
178
+
179
+
180
+
#### Available Fields
181
+
182
+
- `name`: The author's display name (optional, generated from username if not provided)
183
+
- `website`: The author's website URL (optional)
184
+
- `bio`: A short biography (optional, not used in default templates)
185
+
- `avatar`: Path to the author's avatar image (optional, not used in default templates)
186
+
- `socials`: An array of social media links (optional, not used in default templates)
187
+
188
+
#### Notes
189
+
190
+
- Usernames are automatically normalized (converted to lowercase with spaces replaced by underscores)
191
+
- The `PostAuthor` class includes a `getPosts()` method to retrieve all posts by an author
192
+
- Authors can be accessed through `Hyde::authors()`
193
+
194
+
For more advanced usage and customization, refer to the [source code](https://github.com/hydephp/framework/blob/master/src/Framework/Features/Blogging/Models/PostAuthor.php) which is well documented.
195
+
161
196
### Footer
162
197
163
198
Most websites have a footer with copyright details and contact information. You probably want to change the Markdown to include your information, though you are of course welcome to keep the default attribution link!
0 commit comments