thibaud frere commited on
Commit
ef49be8
·
1 Parent(s): a51dcbe
app/src/components/Hero.astro CHANGED
@@ -59,7 +59,7 @@ function slugify(text: string): string {
59
  .slice(0, 120) || 'article';
60
  }
61
 
62
- const pdfBase = titleRaw ? titleRaw : stripHtml(title);
63
  const pdfFilename = `${slugify(pdfBase)}.pdf`;
64
  ---
65
  <section class="hero">
 
59
  .slice(0, 120) || 'article';
60
  }
61
 
62
+ const pdfBase = titleRaw ? stripHtml(titleRaw) : stripHtml(title);
63
  const pdfFilename = `${slugify(pdfBase)}.pdf`;
64
  ---
65
  <section class="hero">
app/src/pages/index.astro CHANGED
@@ -6,7 +6,7 @@ import ThemeToggle from '../components/ThemeToggle.astro';
6
  import Seo from '../components/Seo.astro';
7
  import TableOfContents from '../components/TableOfContents.astro';
8
  // Default OG image served from public/
9
- const ogDefaultUrl = '/thumb.jpg';
10
  import 'katex/dist/katex.min.css';
11
  import '../styles/global.css';
12
  const articleFM = (ArticleMod as any).frontmatter ?? {};
@@ -95,8 +95,9 @@ const imageAbs: string = fmOg && fmOg.startsWith('http')
95
  : (Astro.site ? new URL((fmOg ?? ogDefaultUrl), Astro.site).toString() : (fmOg ?? ogDefaultUrl));
96
 
97
  // ---- Build citation text & BibTeX from frontmatter ----
 
98
  const rawTitle = articleFM?.title ?? 'Untitled article';
99
- const titleFlat = String(rawTitle)
100
  .replace(/\\n/g, ' ')
101
  .replace(/\n/g, ' ')
102
  .replace(/\s+/g, ' ')
 
6
  import Seo from '../components/Seo.astro';
7
  import TableOfContents from '../components/TableOfContents.astro';
8
  // Default OG image served from public/
9
+ const ogDefaultUrl = '/thumb.auto.jpg';
10
  import 'katex/dist/katex.min.css';
11
  import '../styles/global.css';
12
  const articleFM = (ArticleMod as any).frontmatter ?? {};
 
95
  : (Astro.site ? new URL((fmOg ?? ogDefaultUrl), Astro.site).toString() : (fmOg ?? ogDefaultUrl));
96
 
97
  // ---- Build citation text & BibTeX from frontmatter ----
98
+ const stripHtml = (text: string) => String(text || '').replace(/<[^>]*>/g, '');
99
  const rawTitle = articleFM?.title ?? 'Untitled article';
100
+ const titleFlat = stripHtml(String(rawTitle))
101
  .replace(/\\n/g, ' ')
102
  .replace(/\n/g, ' ')
103
  .replace(/\s+/g, ' ')