Fix demo site auto-enhancement and content persistence
- Restructure demo directory from test-sites/ to demos/ with flattened layout - Add auto-enhancement on server startup for all sites with auto_enhance: true - Fix inconsistent content ID generation that prevented dan-eden-portfolio content persistence - Update server configuration to enhance from source to separate output directories - Remove manual enhancement from justfile in favor of automatic server enhancement - Clean up legacy test files and unused restore command - Update build system to use CDN endpoint instead of file copying
This commit is contained in:
@@ -33,12 +33,8 @@ func (g *IDGenerator) Generate(node *html.Node, filePath string) string {
|
||||
tag := strings.ToLower(node.Data)
|
||||
primaryClass := g.getPrimaryClass(node)
|
||||
|
||||
// 3. Position context (simple)
|
||||
elementKey := g.getElementKey(fileName, tag, primaryClass)
|
||||
index := g.getElementIndex(elementKey)
|
||||
|
||||
// 4. Build readable prefix
|
||||
prefix := g.buildPrefix(fileName, tag, primaryClass, index)
|
||||
// 3. Build readable prefix (deterministic, no runtime counting)
|
||||
prefix := g.buildDeterministicPrefix(fileName, tag, primaryClass)
|
||||
|
||||
// 5. Add collision-resistant suffix
|
||||
signature := g.createSignature(node, filePath)
|
||||
@@ -84,7 +80,22 @@ func (g *IDGenerator) getElementIndex(elementKey string) int {
|
||||
return g.elementCounts[elementKey]
|
||||
}
|
||||
|
||||
// buildPrefix creates human-readable prefix for the ID
|
||||
// buildDeterministicPrefix creates human-readable prefix without runtime counting
|
||||
func (g *IDGenerator) buildDeterministicPrefix(fileName, tag, primaryClass string) string {
|
||||
var parts []string
|
||||
parts = append(parts, fileName)
|
||||
|
||||
if primaryClass != "" {
|
||||
parts = append(parts, primaryClass)
|
||||
} else {
|
||||
parts = append(parts, tag)
|
||||
}
|
||||
|
||||
// No runtime index - rely on hash for uniqueness
|
||||
return strings.Join(parts, "-")
|
||||
}
|
||||
|
||||
// buildPrefix creates human-readable prefix for the ID (legacy method)
|
||||
func (g *IDGenerator) buildPrefix(fileName, tag, primaryClass string, index int) string {
|
||||
var parts []string
|
||||
parts = append(parts, fileName)
|
||||
|
||||
Reference in New Issue
Block a user