(str: string)
| 6 | |
| 7 | // A very simple hasher to get an offset for blog posts on the same day |
| 8 | const simpleHash = (str: string): number => { |
| 9 | let h = 0 |
| 10 | for (let i = 0; i < str.length; i++) { |
| 11 | h = ((h << 5) - h + str.charCodeAt(i)) >>> 0 |
| 12 | } |
| 13 | return h |
| 14 | } |
| 15 | |
| 16 | // Parse date from frontmatter, add slug-path entropy for same-date collision resolution |
| 17 | export const generateBlogTID = (dateString: string, slug: string): string => { |