Implement comprehensive homepage improvements and SEO optimization

Major homepage and SEO enhancements based on optimization document:

**Homepage Content Updates:**
- Updated H1 titles with SEO-optimized text for both RO/EN
- Enhanced hero descriptions with targeted keywords
- Improved feature descriptions for better clarity
- Updated daily verse section with keyword-rich titles
- Added new footer description with SEO focus

**SEO Implementation:**
- Added dynamic metadata generation with locale-specific SEO
- Implemented Open Graph tags for social media sharing
- Added Twitter Card metadata for enhanced sharing
- Integrated Schema.org JSON-LD structured data
- Set up hreflang tags for international SEO
- Added canonical URLs to prevent duplicate content
- Included targeted keywords for both languages

**Technical Improvements:**
- Migrated from Docker to PM2 deployment
- Removed Docker files and updated deployment scripts
- Updated README with PM2 instructions
- Fixed console log cleanup for production
- Added proper favicon with Next.js app directory
- Increased memory limit to 4GB for better performance
- Updated port configuration to 0.0.0.0:3010
- Set Romanian (/ro) as default locale with proper redirects

**Translation Updates:**
- Enhanced Romanian translations with SEO-optimized content
- Updated English translations with matching SEO improvements
- Added new 'seo' namespace for metadata translations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Assistant
2025-09-22 18:40:21 +00:00
parent b24251eb2d
commit d4b0062521
18 changed files with 256 additions and 249 deletions

View File

@@ -38,7 +38,6 @@ export function AuthProvider({ children }: AuthProviderProps) {
// Check if token is expired before making request
if (isTokenExpired(token)) {
console.log('Token expired in refreshUser, clearing auth state')
localStorage.removeItem('authToken')
setUser(null)
setIsLoading(false)
@@ -62,14 +61,6 @@ export function AuthProvider({ children }: AuthProviderProps) {
const data = await response.json()
setUser(data.user)
} else {
// Token is invalid or expired, get error details
try {
const errorData = await response.json()
console.log('Server returned 401 error:', errorData)
} catch (e) {
console.log('Server returned 401 without JSON body, status:', response.status)
}
console.log('Token expired or invalid, clearing auth state')
localStorage.removeItem('authToken')
setUser(null)
}
@@ -83,81 +74,18 @@ export function AuthProvider({ children }: AuthProviderProps) {
}
}
// Debug database schema
const debugSchema = async () => {
try {
const response = await fetch('/api/debug/schema')
const debug = await response.json()
console.log('Database schema info:', debug)
} catch (e) {
console.log('Schema debug failed:', e)
}
}
// Debug user lookup
const debugUser = async (userId: string) => {
try {
const response = await fetch('/api/debug/user', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ userId })
})
const debug = await response.json()
console.log('User debug info:', debug)
} catch (e) {
console.log('User debug failed:', e)
}
}
// Debug token validation
const debugToken = async (token: string) => {
try {
const response = await fetch('/api/debug/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ token })
})
const debug = await response.json()
console.log('Token debug info:', debug)
// Log more details about the token payload
if (debug.payload) {
console.log('Token payload:', debug.payload)
// Debug user lookup
if (debug.payload.userId) {
debugUser(debug.payload.userId)
}
}
if (debug.verificationResult) {
console.log('Verification result:', debug.verificationResult)
}
} catch (e) {
console.log('Token debug failed:', e)
}
}
// Clear expired tokens and sync state immediately on mount
useEffect(() => {
if (typeof window !== 'undefined') {
const token = localStorage.getItem('authToken')
console.log('Auth mount check - token exists:', !!token)
if (token) {
console.log('Token preview:', token.substring(0, 50) + '...')
// Debug the database schema and token on server side
debugSchema()
debugToken(token)
const expired = isTokenExpired(token)
console.log('Token expired:', expired)
if (expired) {
console.log('Clearing expired token and user state on mount')
localStorage.removeItem('authToken')
setUser(null)
}
} else if (user) {
console.log('No token but user exists in store, clearing user state')
setUser(null)
}
clearExpiredToken()
@@ -168,23 +96,19 @@ export function AuthProvider({ children }: AuthProviderProps) {
useEffect(() => {
if (!initialized && typeof window !== 'undefined') {
const token = localStorage.getItem('authToken')
console.log('Initialization flow - token exists:', !!token)
if (token) {
// Check if token is expired before making request
if (isTokenExpired(token)) {
console.log('Token expired during initialization, clearing auth state')
localStorage.removeItem('authToken')
setUser(null)
setIsLoading(false)
} else {
console.log('Token is valid, calling refreshUser()')
// Token appears valid, try to refresh user data
// refreshUser will handle server-side validation failures
refreshUser()
}
} else {
console.log('No token found, clearing user state')
// No token, clear any stale user data
setUser(null)
setIsLoading(false)