Issues (467)

config/hyde.php (2 issues)

Labels
Severity
1
<?php
2
3
/*
4
|--------------------------------------------------------------------------
5
|      __ __        __    ___  __ _____
6
|     / // /_ _____/ /__ / _ \/ // / _ \
7
|    / _  / // / _  / -_) ___/ _  / ___/
8
|   /_//_/\_, /\_,_/\__/_/  /_//_/_/
9
|        /___/
10
|--------------------------------------------------------------------------
11
|
12
| Welcome to HydePHP! In this file, you can customize your new Static Site!
13
|
14
| HydePHP favours convention over configuration and as such requires virtually
15
| no configuration out of the box to get started. Though, you may want to
16
| change the options to personalize your site and make it your own!
17
|
18
| Tip: The settings here can also be overridden by creating a hyde.yml file
19
| in the root of your project directory. Note that these cannot call any
20
| PHP functions, so you can't use env() or similar helpers. Also, note
21
| that any settings in the yml file will override settings here.
22
|
23
*/
24
25
use Hyde\Facades\Author;
0 ignored issues
show
This use statement conflicts with another class in this namespace, Author. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
26
use Hyde\Facades\Meta;
0 ignored issues
show
This use statement conflicts with another class in this namespace, Meta. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
27
use Hyde\Enums\Feature;
28
use Hyde\Facades\Navigation;
29
30
return [
31
32
    /*
33
    |--------------------------------------------------------------------------
34
    | Site Name
35
    |--------------------------------------------------------------------------
36
    |
37
    | This value sets the name of your site and is, for example, used in
38
    | the compiled page titles and more. The default value is HydePHP.
39
    |
40
    */
41
42
    'name' => env('SITE_NAME', 'HydePHP'),
43
44
    /*
45
    |--------------------------------------------------------------------------
46
    | Site Base URL
47
    |--------------------------------------------------------------------------
48
    |
49
    | Setting a base URL is highly recommended, and is required to use some
50
    | HydePHP features, like automatic sitemaps and RSS feeds.
51
    |
52
    | If you are serving your site from a subdirectory,
53
    | you will need to include that in the path.
54
    |
55
    */
56
57
    'url' => env('SITE_URL', 'http://localhost'),
58
59
    /*
60
    |--------------------------------------------------------------------------
61
    | Site Language
62
    |--------------------------------------------------------------------------
63
    |
64
    | This value sets the language of your site and is used for the
65
    | <html lang=""> element in the app layout. Default is 'en'.
66
    |
67
    */
68
69
    'language' => 'en',
70
71
    /*
72
    |--------------------------------------------------------------------------
73
    | Pretty URLs
74
    |--------------------------------------------------------------------------
75
    |
76
    | When the setting is enabled, generated links in the compiled HTML site
77
    | are without the .html extension, in other words, "pretty" URLs.
78
    |
79
    | This setting can also be enabled on a per-compile basis by supplying
80
    | the `--pretty-urls` option when you run the build command.
81
    |
82
    */
83
84
    'pretty_urls' => false,
85
86
    /*
87
    |--------------------------------------------------------------------------
88
    | Sitemap Generation
89
    |--------------------------------------------------------------------------
90
    |
91
    | When the setting is enabled, a sitemap.xml file will automatically be
92
    | generated when you compile your static site.
93
    |
94
    | This feature requires that a site base URL has been set.
95
    |
96
    */
97
98
    'generate_sitemap' => true,
99
100
    /*
101
    |--------------------------------------------------------------------------
102
    | RSS Feed Generation
103
    |--------------------------------------------------------------------------
104
    |
105
    | When enabled, an RSS feed with your Markdown blog posts will be
106
    | generated when you compile your static site.
107
    |
108
    | This feature requires that a site base URL has been set.
109
    |
110
    */
111
112
    'rss' => [
113
        // Should the RSS feed be generated?
114
        'enabled' => true,
115
116
        // What filename should the RSS file use?
117
        'filename' => 'feed.xml',
118
119
        // The channel description.
120
        'description' => env('SITE_NAME', 'HydePHP').' RSS Feed',
121
    ],
122
123
    /*
124
    |--------------------------------------------------------------------------
125
    | Source Root Directory
126
    |--------------------------------------------------------------------------
127
    |
128
    | HydePHP will by default look for the underscored source directories in the
129
    | root of your project. For example, you might want everything in a 'src'
130
    | subdirectory. That's easy enough, just set the value below to "src"!
131
    |
132
    */
133
134
    'source_root' => '',
135
136
    /*
137
    |--------------------------------------------------------------------------
138
    | Site Output Directory
139
    |--------------------------------------------------------------------------
140
    |
141
    | This setting specifies the output path for your site, useful to for
142
    | example, store the site in the docs/ directory for GitHub Pages.
143
    | The path is relative to the root of your project.
144
    |
145
    */
146
147
    'output_directory' => '_site',
148
149
    /*
150
    |--------------------------------------------------------------------------
151
    | Source Directories
152
    |--------------------------------------------------------------------------
153
    |
154
    | The directories you place your content in are important. The directory
155
    | will be used to determine the proper page type and the templates used.
156
    | If you are not happy with these defaults, you can change them here.
157
    | Note that these are relative to the `source_root` setting above.
158
    |
159
    */
160
161
    'source_directories' => [
162
        \Hyde\Pages\HtmlPage::class => '_pages',
163
        \Hyde\Pages\BladePage::class => '_pages',
164
        \Hyde\Pages\MarkdownPage::class => '_pages',
165
        \Hyde\Pages\MarkdownPost::class => '_posts',
166
        \Hyde\Pages\DocumentationPage::class => '_docs',
167
    ],
168
169
    /*
170
    |--------------------------------------------------------------------------
171
    | Output Directories
172
    |--------------------------------------------------------------------------
173
    |
174
    | Like the source directories, the output directories are also important
175
    | as they determine the final output path for each page type in your
176
    | compiled static site. This change also affects the route keys.
177
    |
178
    | Note that these are relative to the site's `output_directory` setting.
179
    | Setting the value to '' will output the page to the root of the site.
180
    |
181
    */
182
183
    'output_directories' => [
184
        \Hyde\Pages\HtmlPage::class => '',
185
        \Hyde\Pages\BladePage::class => '',
186
        \Hyde\Pages\MarkdownPage::class => '',
187
        \Hyde\Pages\MarkdownPost::class => 'posts',
188
        \Hyde\Pages\DocumentationPage::class => 'docs',
189
    ],
190
191
    /*
192
    |--------------------------------------------------------------------------
193
    | Media Directory
194
    |--------------------------------------------------------------------------
195
    |
196
    | This setting specifies the directory where your media files are stored.
197
    | Note that this affects both the source and output directories.
198
    | The path is relative to the root of your project.
199
    |
200
    */
201
202
    'media_directory' => '_media',
203
204
    /*
205
    |--------------------------------------------------------------------------
206
    | Global Site Meta Tags
207
    |--------------------------------------------------------------------------
208
    |
209
    | While you can add any number of meta tags in the meta.blade.php component
210
    | using standard HTML, you can also use the Meta helper. To add a regular
211
    | meta tag, use Meta::name() helper. To add an Open Graph property, use
212
    | Meta::property() helper which also adds the `og:` prefix for you.
213
    |
214
    | Please note that some pages like blog posts contain dynamic meta tags
215
    | which may override these globals when present in the front matter.
216
    |
217
    */
218
219
    'meta' => [
220
        // Meta::name('author', 'Mr. Hyde'),
221
        // Meta::name('twitter:creator', '@HydeFramework'),
222
        // Meta::name('description', 'My Hyde Blog'),
223
        // Meta::name('keywords', 'Static Sites, Blogs, Documentation'),
224
        Meta::name('generator', 'HydePHP v'.Hyde\Hyde::version()),
225
        Meta::property('site_name', env('SITE_NAME', 'HydePHP')),
226
    ],
227
228
    /*
229
    |--------------------------------------------------------------------------
230
    | Custom head and script HTML hooks
231
    |--------------------------------------------------------------------------
232
    |
233
    | While the best way to add custom `<head>` and `<body>` code is to use the
234
    | Blade components, you can also add them here. This is useful for adding
235
    | scripts like analytics codes, chat widgets, or even custom styles.
236
    |
237
    */
238
239
    // Add any extra HTML to include in the <head> tag
240
    'head' => '',
241
242
    // Add any extra HTML to include before the closing <body> tag
243
    'scripts' => '',
244
245
    /*
246
    |--------------------------------------------------------------------------
247
    | Features
248
    |--------------------------------------------------------------------------
249
    |
250
    | Some of Hyde's features are optional. Feel free to disable the features
251
    | you don't need by removing or commenting them out from this array.
252
    |
253
    */
254
255
    'features' => [
256
        // Page Modules
257
        Feature::HtmlPages,
258
        Feature::MarkdownPosts,
259
        Feature::BladePages,
260
        Feature::MarkdownPages,
261
        Feature::DocumentationPages,
262
263
        // Frontend Features
264
        Feature::Darkmode,
265
        Feature::DocumentationSearch,
266
267
        // Integrations
268
        Feature::Torchlight,
269
    ],
270
271
    /*
272
    |--------------------------------------------------------------------------
273
    | Blog Post Authors
274
    |--------------------------------------------------------------------------
275
    |
276
    | Hyde has support for adding authors in front matter, for example to
277
    | automatically add a link to your website or social media profiles.
278
    | However, it's tedious to have to add those to each and every
279
    | post you make, and keeping them updated is even harder.
280
    |
281
    | To solve this problem, you can add predefined authors with this setting.
282
    | When writing posts just specify the author's username (the array key).
283
    | Hyde will pull the matching data from here and fill in the blanks.
284
    |
285
    */
286
287
    'authors' => [
288
        'mr_hyde' => Author::create(
289
            // The following settings are used in the default blog post template.
290
            name: 'Mr. Hyde', // Optional display name
291
            website: 'https://hydephp.com', // Optional website URL
292
293
            // The following settings are not used in the bundled templates,
294
            // but you can use them in your own custom views, for example.
295
            // bio: 'The mysterious author of HydePHP',
296
            // avatar: 'avatar.png',
297
            // socials: [
298
            //     'twitter' => 'HydeFramework',
299
            //     'github' => 'hydephp',
300
            // ],
301
        ),
302
    ],
303
304
    /*
305
    |--------------------------------------------------------------------------
306
    | Footer Text
307
    |--------------------------------------------------------------------------
308
    |
309
    | Here you can customize the footer Markdown text for your site.
310
    |
311
    | If you don't want to write Markdown here, you use a Markdown include.
312
    | You can also customize the Blade view if you want a more complex footer.
313
    | You can disable it completely by changing the setting to `false`.
314
    |
315
    | To read about the many configuration options here, visit:
316
    | https://hydephp.com/docs/1.x/customization#footer
317
    |
318
    */
319
320
    'footer' => 'Site proudly built with [HydePHP](https://github.com/hydephp/hyde) 🎩',
321
322
    /*
323
    |--------------------------------------------------------------------------
324
    | Navigation Menu Configuration
325
    |--------------------------------------------------------------------------
326
    |
327
    | If you are looking to customize the main navigation menu, this is the place!
328
    |
329
    | All these settings uses Route Keys to identify the page you want to configure.
330
    | A route key is simply the URL path to the page, without the file extension.
331
    | So `_site/posts/hello-world.html` has the route key 'posts/hello-world'.
332
    |
333
    */
334
335
    'navigation' => [
336
        // This configuration sets the priorities used to determine the order of the menu.
337
        // The default values have been added below for reference and easy editing.
338
        // The array key is the page's route key, the value is the priority.
339
        // Lower values show up first in the menu. The default is 999.
340
        'order' => [
341
            'index' => 0,
342
            'posts' => 10,
343
            'docs/index' => 100,
344
        ],
345
346
        // In case you want to customize the labels for the menu items, you can do so here.
347
        // Simply add the route key as the array key, and the label as the value.
348
        'labels' => [
349
            'index' => 'Home',
350
            'docs/index' => 'Docs',
351
        ],
352
353
        // These are the route keys of pages that should not show up in the navigation menu.
354
        'exclude' => [
355
            '404',
356
        ],
357
358
        // Any extra links you want to add to the navigation menu can be added here.
359
        // To get started quickly, you can uncomment the defaults here.
360
        // See the documentation link above for more information.
361
        'custom' => [
362
            // Navigation::item('https://github.com/hydephp/hyde', 'GitHub', 200),
363
        ],
364
365
        // How should pages in subdirectories be displayed in the menu?
366
        // You can choose between 'dropdown', 'flat', and 'hidden'.
367
        'subdirectory_display' => 'hidden',
368
    ],
369
370
    /*
371
    |--------------------------------------------------------------------------
372
    | Cache Busting
373
    |--------------------------------------------------------------------------
374
    |
375
    | Any assets loaded using the Hyde Asset helpers will automatically have
376
    | a "cache busting" query string appended to the URL. This is useful
377
    | when you want to force browsers to load a new version of an asset.
378
    | All included Blade templates use this feature to load assets.
379
    |
380
    | To disable the cache busting, set this setting to false.
381
    |
382
    */
383
384
    'cache_busting' => true,
385
386
    /*
387
    |--------------------------------------------------------------------------
388
    | Load app.css from CDN
389
    |--------------------------------------------------------------------------
390
    |
391
    | Hyde ships with an app.css file containing compiled TailwindCSS styles
392
    | in the _media/ directory. If you want to load this file from the
393
    | HydeFront JsDelivr CDN, you can set this setting to true.
394
    |
395
    */
396
397
    'load_app_styles_from_cdn' => false,
398
399
    /*
400
     |--------------------------------------------------------------------------
401
     | Tailwind Play CDN
402
     |--------------------------------------------------------------------------
403
     |
404
     | The next setting enables a script for the TailwindCSS Play CDN which will
405
     | compile CSS in the browser. While this is useful for local development
406
     | it's not recommended for production use. To keep things consistent,
407
     | your Tailwind configuration file will be injected into the HTML.
408
     */
409
410
    'use_play_cdn' => false,
411
412
    /*
413
    |--------------------------------------------------------------------------
414
    | Default Color Scheme
415
    |--------------------------------------------------------------------------
416
    |
417
    | The default color scheme for the meta color-scheme tag, note that this
418
    | is just a hint to the user-agent and does not force a specific theme.
419
    |
420
    */
421
422
    'default_color_scheme' => 'light',
423
424
    /*
425
    |--------------------------------------------------------------------------
426
    | Built-in Server
427
    |--------------------------------------------------------------------------
428
    |
429
    | Here you can configure settings for the built-in realtime compiler server.
430
    | The server also includes a magic dashboard feature that supercharges
431
    | your local development! This feature can alo be customised here.
432
    |
433
    */
434
435
    'server' => [
436
        // The default port the preview is served on
437
        'port' => env('SERVER_PORT', 8080),
438
439
        // The default host the preview is served on
440
        'host' => env('SERVER_HOST', 'localhost'),
441
442
        // Should preview pages be saved to the output directory?
443
        'save_preview' => env('SERVER_SAVE_PREVIEW', false),
444
445
        // Should the live edit feature be enabled?
446
        'live_edit' => env('SERVER_LIVE_EDIT', true),
447
448
        // Configure the realtime compiler dashboard
449
        'dashboard' => [
450
            // Should the realtime compiler dashboard be enabled?
451
            'enabled' => env('SERVER_DASHBOARD', true),
452
453
            // Can the dashboard make edits to the project file system?
454
            'interactive' => true,
455
456
            // Should the dashboard show tips?
457
            'tips' => true,
458
        ],
459
    ],
460
461
    /*
462
    |--------------------------------------------------------------------------
463
    | Additional Advanced Options
464
    |--------------------------------------------------------------------------
465
    |
466
    | Finally, here are some additional configuration options that you most
467
    | likely won't need to change. These are intended for advanced users,
468
    | and some should only be changed if you know what you're doing.
469
    |
470
    */
471
472
    // Change the file extensions to be considered as media files and are copied to the output directory.
473
    // If you want to add more extensions, add it to the empty merge array, or just override the entire array.
474
    'media_extensions' => array_merge([], \Hyde\Support\Filesystem\MediaFile::EXTENSIONS),
475
476
    // The list of directories that are considered to be safe to empty upon site build.
477
    // If the site output directory is set to a directory that is not in this list,
478
    // the build command will prompt for confirmation before emptying it.
479
    'safe_output_directories' => ['_site', 'docs', 'build'],
480
481
    // Should a JSON build manifest with metadata about the build be generated?
482
    'generate_build_manifest' => true,
483
484
    // Where should the build manifest be saved? (Relative to project root, for example _site/build-manifest.json)
485
    'build_manifest_path' => 'app/storage/framework/cache/build-manifest.json',
486
487
    // Should the theme toggle buttons be displayed in the layouts?
488
    'theme_toggle_buttons' => true,
489
490
];
491