# Thymeleaf Best Practices for Halo Themes
**1. Prefer literal substitutions over string concatenation**
```html
```
**2. Use safe navigation `?.` to avoid NullPointerException**
```html
```
**3. Use Elvis operator `?:` for default values**
```html
```
**4. Use `th:block` to group without adding extra DOM elements**
```html
```
**5. Use `th:classappend` for conditional classes**
```html
...
...
```
**6. Use `#lists.isEmpty()` and `#strings.isEmpty()` for null-safe checks**
```html
```
**7. Do not manually add meta tags — Halo injects them automatically**
Only `` needs to be in the theme. Halo automatically injects at runtime:
- `` and ``
- Open Graph tags (`og:title`, `og:description`, `og:image`, etc.)
- Twitter Card tags and canonical URL
```html
Site Title
Site Title
```
**8. Use `@{${url}}` for dynamic permalink URLs**
```html
...
...
```