+ = htmlspecialchars($post['title']) ?> +
+= htmlspecialchars($preview) ?>
+ +diff --git a/database/migration_003_profile_slug.sql b/database/migration_003_profile_slug.sql new file mode 100644 index 0000000..e8f9911 --- /dev/null +++ b/database/migration_003_profile_slug.sql @@ -0,0 +1,2 @@ +ALTER TABLE user_profiles ADD COLUMN IF NOT EXISTS profile_slug TEXT NOT NULL DEFAULT ''; +CREATE UNIQUE INDEX IF NOT EXISTS user_profiles_profile_slug_idx ON user_profiles (profile_slug) WHERE profile_slug <> ''; diff --git a/public/.htaccess b/public/.htaccess index 5fe8181..2a62dab 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -41,6 +41,9 @@ RewriteRule ^categories/?$ /index.php?action=categories [L,QSA] RewriteRule ^profile/?$ /index.php?action=profile [L,QSA] RewriteRule ^search/?$ /index.php?action=search [L,QSA] +# Profil public auteur +RewriteRule ^profil/([a-z0-9][a-z0-9-]*)/?$ /index.php?action=author&slug=$1 [L,QSA] + # Pages statiques RewriteRule ^about/?$ /index.php?action=about [L,QSA] RewriteRule ^legal/?$ /index.php?action=legal [L,QSA] diff --git a/public/assets/css/style.css b/public/assets/css/style.css index 60b302e..c4a13b1 100644 --- a/public/assets/css/style.css +++ b/public/assets/css/style.css @@ -1242,3 +1242,38 @@ footer.mt-5 { margin-top: 0 !important; } } .tag-cloud-reset:hover { color: var(--vl-accent); } + +/* ─── Profil public auteur ───────────────── */ + +.author-profile-hero { + display: flex; + align-items: center; + gap: 1.5rem; +} + +.author-avatar { + flex-shrink: 0; + width: 4rem; + height: 4rem; + border-radius: 50%; + background: var(--vl-accent); + color: #fff; + font-size: 1.75rem; + font-weight: 700; + display: flex; + align-items: center; + justify-content: center; +} + +.author-profile-name { + font-size: 1.5rem; + font-weight: 700; + margin: 0 0 .25rem; +} + +.author-profile-link { + font-size: .875rem; + color: var(--vl-muted); +} + +.author-profile-link:hover { color: var(--vl-accent); } diff --git a/public/index.php b/public/index.php index fb052bb..d2d88bb 100644 --- a/public/index.php +++ b/public/index.php @@ -851,6 +851,36 @@ switch ($action) { header('Location: /categories'); exit; + case 'author': + $authorSlug = trim($_GET['slug'] ?? ''); + $authorRow = profileBySlug($authorSlug); + if (!$authorRow) { + http_response_code(404); + $content = '
Profil introuvable.
Aucun article publié.
+ += htmlspecialchars($preview) ?>
+ +