Skip to content

Commit

Permalink
Merge pull request #237 from hydephp/refactor-configuration-options
Browse files Browse the repository at this point in the history
Create site.php config for site-specific settings
  • Loading branch information
caendesilva authored Jul 18, 2022
2 parents a7bfc78 + 52a7ec8 commit fc18f3d
Show file tree
Hide file tree
Showing 44 changed files with 243 additions and 542 deletions.
32 changes: 26 additions & 6 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,47 @@

### About

Keep an Unreleased section at the top to track upcoming changes.

This serves two purposes:

1. People can see what changes they might expect in upcoming releases
2. At release time, you can move the Unreleased section changes into a new release version section.
This update makes breaking changes to the configuration. You will need to update your configuration to continue using the new changes. Each one has been documented in this changelog entry, which at the end has an upgrade guide.

### Added
- for new features.

### Changed
- internal: Refactor navigation menu components and improve link helpers

- Moved config option `hyde.name` to `site.name`
- Moved config option `hyde.site_url` to `site.site_url`
- Moved config option `hyde.pretty_urls` to `site.pretty_urls`
- Moved config option `hyde.generate_sitemap` to `site.generate_sitemap`
- Moved config option `hyde.language` to `site.language`
- Moved config option `hyde.output_directory` to `site.output_directory`

### Deprecated
- for soon-to-be removed features.

### Removed
- Removed `\Hyde\Framework\Facades\Route`. You can swap out usages with `\Hyde\Framework\Models\Route` without side effects.

- Removed internal `$siteName` config variable from `config/hyde.php`

### Fixed
- for any bug fixes.

### Security
- in case of vulnerabilities.


### Upgrade Guide

Site-specific config options have been moved from `config/hyde.php` to `config/site.php`. The Hyde config is now used to configure behaviour of the site, while the site config is used to customize the look and feel, the presentation, of the site.

The following configuration options have been moved. The actual usages remain the same, so you can upgrade by using copying over these options to the new file.

- `hyde.name`
- `hyde.site_url`
- `hyde.pretty_urls`
- `hyde.generate_sitemap`
- `hyde.language`
- `hyde.output_directory`

If you have published and Blade views or written custom code that uses the config options, you may need to update them. You can do this by republishing the Blade views, and/or using search and replace across your code. VSCode has a useful feature to make this a breeze: `CMD/CTRL+Shift+F`.
2 changes: 1 addition & 1 deletion _pages/404.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
Sorry, the page you are looking for could not be found.
</p>

<a href="{{ config('hyde.site_url') ?? '/' }}">
<a href="{{ config('site.site_url') ?? '/' }}">
<button
class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
Go Home
Expand Down
2 changes: 1 addition & 1 deletion config/docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
|
*/

'header_title' => config('hyde.name', 'HydePHP').' Docs',
'header_title' => config('site.name', 'HydePHP').' Docs',

/*
|--------------------------------------------------------------------------
Expand Down
71 changes: 1 addition & 70 deletions config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,58 +23,6 @@
use Hyde\Framework\Models\NavItem;

return [

/*
|--------------------------------------------------------------------------
| Site Name
|--------------------------------------------------------------------------
|
| This value sets the name of your site and is, for example, used in
| the compiled page titles and more. The default value is HydePHP.
|
| The name is stored in the $siteName variable so it can be
| used again later on in this config.
|
*/

'name' => $siteName = env('SITE_NAME', 'HydePHP'),

/*
|--------------------------------------------------------------------------
| Site URL Configuration
|--------------------------------------------------------------------------
|
| Here are some configuration options for URL generation.
|
| A site_url is required to use sitemaps and RSS feeds.
|
| `site_url` is used to create canonical URLs and permalinks.
| `prettyUrls` will when enabled create links that do not end in .html.
| `generateSitemap` determines if a sitemap.xml file should be generated.
|
| To see the full documentation, please visit the documentation link below.
| https://hydephp.com/docs/master/customization#site-url-configuration
|
*/

'site_url' => env('SITE_URL', null),

'pretty_urls' => false,

'generate_sitemap' => true,

/*
|--------------------------------------------------------------------------
| Site Language
|--------------------------------------------------------------------------
|
| This value sets the language of your site and is used for the
| <html lang=""> element in the app layout. Default is 'en'.
|
*/

'language' => 'en',

/*
|--------------------------------------------------------------------------
| Global Site Meta Tags
Expand All @@ -96,7 +44,7 @@
// Meta::name('description', 'My Hyde Blog'),
// Meta::name('keywords', 'Static Sites, Blogs, Documentation'),
Meta::name('generator', 'HydePHP '.Hyde\Framework\Hyde::version()),
Meta::property('site_name', $siteName),
Meta::property('site_name', config('site.name', 'HydePHP')),
],

/*
Expand Down Expand Up @@ -202,21 +150,4 @@
// NavItem::toLink('https://github.com/hydephp/hyde', 'GitHub', 200),
],
],

/*
|--------------------------------------------------------------------------
| Site Output Directory (Experimental 🧪)
|--------------------------------------------------------------------------
|
| This setting specifies the output path for your site, useful to for
| example, store the site in the docs/ directory for GitHub Pages.
| The path is relative to the root of your project.
|
| To use an absolute path, or just to learn more:
| @see https://hydephp.com/docs/master/advanced-customization#customizing-the-output-directory-
|
*/

'output_directory' => '_site',

];
98 changes: 98 additions & 0 deletions config/site.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php

/*
|--------------------------------------------------------------------------
| __ __ __ ___ __ _____
| / // /_ _____/ /__ / _ \/ // / _ \
| / _ / // / _ / -_) ___/ _ / ___/
| /_//_/\_, /\_,_/\__/_/ /_//_/_/
| /___/
|--------------------------------------------------------------------------
|
| Welcome to HydePHP! In this file, you can customize your new Static Site!
|
| HydePHP favours convention over configuration and as such requires virtually
| no configuration out of the box to get started. Though, you may want to
| change the options to personalize your site and make it your own!
|
*/

return [

/*
|--------------------------------------------------------------------------
| Site Name
|--------------------------------------------------------------------------
|
| This value sets the name of your site and is, for example, used in
| the compiled page titles and more. The default value is HydePHP.
|
*/

'name' => env('SITE_NAME', 'HydePHP'),

/*
|--------------------------------------------------------------------------
| Site URL Configuration
|--------------------------------------------------------------------------
|
| Here are some configuration options for URL generation.
|
| A site_url is required to use sitemaps and RSS feeds.
|
| `site_url` is used to create canonical URLs and permalinks.
| `prettyUrls` will when enabled create links that do not end in .html.
| `generateSitemap` determines if a sitemap.xml file should be generated.
|
| To see the full documentation, please visit the documentation link below.
| https://hydephp.com/docs/master/customization#site-url-configuration
|
*/

'site_url' => env('SITE_URL', null),

'pretty_urls' => false,

'generate_sitemap' => true,

/*
|--------------------------------------------------------------------------
| Site Language
|--------------------------------------------------------------------------
|
| This value sets the language of your site and is used for the
| <html lang=""> element in the app layout. Default is 'en'.
|
*/

'language' => 'en',

/*
|--------------------------------------------------------------------------
| Navigation Menu Configuration
|--------------------------------------------------------------------------
|
| If you are looking to customize the navigation menu links, this is the place!
|
| See the documentation for the full list of options:
| https://hydephp.com/docs/master/customization#navigation-menu--sidebar
|
*/

/*
|--------------------------------------------------------------------------
| Site Output Directory (Experimental 🧪)
|--------------------------------------------------------------------------
|
| This setting specifies the output path for your site, useful to for
| example, store the site in the docs/ directory for GitHub Pages.
| The path is relative to the root of your project.
|
| To use an absolute path, or just to learn more:
| @see https://hydephp.com/docs/master/advanced-customization#customizing-the-output-directory-
|
*/

'output_directory' => '_site',

];
2 changes: 1 addition & 1 deletion packages/framework/config/docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
|
*/

'header_title' => config('hyde.name', 'HydePHP').' Docs',
'header_title' => config('site.name', 'HydePHP').' Docs',

/*
|--------------------------------------------------------------------------
Expand Down
71 changes: 1 addition & 70 deletions packages/framework/config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,58 +23,6 @@
use Hyde\Framework\Models\NavItem;

return [

/*
|--------------------------------------------------------------------------
| Site Name
|--------------------------------------------------------------------------
|
| This value sets the name of your site and is, for example, used in
| the compiled page titles and more. The default value is HydePHP.
|
| The name is stored in the $siteName variable so it can be
| used again later on in this config.
|
*/

'name' => $siteName = env('SITE_NAME', 'HydePHP'),

/*
|--------------------------------------------------------------------------
| Site URL Configuration
|--------------------------------------------------------------------------
|
| Here are some configuration options for URL generation.
|
| A site_url is required to use sitemaps and RSS feeds.
|
| `site_url` is used to create canonical URLs and permalinks.
| `prettyUrls` will when enabled create links that do not end in .html.
| `generateSitemap` determines if a sitemap.xml file should be generated.
|
| To see the full documentation, please visit the documentation link below.
| https://hydephp.com/docs/master/customization#site-url-configuration
|
*/

'site_url' => env('SITE_URL', null),

'pretty_urls' => false,

'generate_sitemap' => true,

/*
|--------------------------------------------------------------------------
| Site Language
|--------------------------------------------------------------------------
|
| This value sets the language of your site and is used for the
| <html lang=""> element in the app layout. Default is 'en'.
|
*/

'language' => 'en',

/*
|--------------------------------------------------------------------------
| Global Site Meta Tags
Expand All @@ -96,7 +44,7 @@
// Meta::name('description', 'My Hyde Blog'),
// Meta::name('keywords', 'Static Sites, Blogs, Documentation'),
Meta::name('generator', 'HydePHP '.Hyde\Framework\Hyde::version()),
Meta::property('site_name', $siteName),
Meta::property('site_name', config('site.name', 'HydePHP')),
],

/*
Expand Down Expand Up @@ -202,21 +150,4 @@
// NavItem::toLink('https://github.com/hydephp/hyde', 'GitHub', 200),
],
],

/*
|--------------------------------------------------------------------------
| Site Output Directory (Experimental 🧪)
|--------------------------------------------------------------------------
|
| This setting specifies the output path for your site, useful to for
| example, store the site in the docs/ directory for GitHub Pages.
| The path is relative to the root of your project.
|
| To use an absolute path, or just to learn more:
| @see https://hydephp.com/docs/master/advanced-customization#customizing-the-output-directory-
|
*/

'output_directory' => '_site',

];
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<a href="{{ $navigation->getHomeLink() }}" class="font-bold px-4" aria-label="Home page">
{{ config('hyde.name', 'HydePHP') }}
{{ config('site.name', 'HydePHP') }}
</a>
2 changes: 1 addition & 1 deletion packages/framework/resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ config('hyde.language', 'en') }}">
<html lang="{{ config('site.language', 'en') }}">
<head>
@include('hyde::layouts.head')
</head>
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/resources/views/layouts/docs.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ config('hyde.language', 'en') }}">
<html lang="{{ config('site.language', 'en') }}">
<head>
@include('hyde::layouts.head')
</head>
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/resources/views/layouts/head.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ isset($title) ? config('hyde.name', 'HydePHP') . ' - ' . $title : config('hyde.name', 'HydePHP') }}</title>
<title>{{ isset($title) ? config('site.name', 'HydePHP') . ' - ' . $title : config('site.name', 'HydePHP') }}</title>

@if (file_exists(Hyde::path('_media/favicon.ico')))
<link rel="shortcut icon" href="{{ Hyde::relativeLink('media/favicon.ico') }}" type="image/x-icon">
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/resources/views/pages/404.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
Sorry, the page you are looking for could not be found.
</p>

<a href="{{ config('hyde.site_url') ?? '/' }}">
<a href="{{ config('site.site_url') ?? '/' }}">
<button
class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
Go Home
Expand Down
Loading

0 comments on commit fc18f3d

Please sign in to comment.