Skip to content

Commit

Permalink
refactor: article header to use single article attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
limulus committed Jan 20, 2025
1 parent 828522b commit dba042d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
27 changes: 19 additions & 8 deletions www/_includes/components/article-header.webc
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
<header webc:root="override">
<article-photo webc:if="hero" :@id="hero" placement="hero"></article-photo>
<article-photo
webc:if="article.hero"
:@id="article.hero"
placement="hero"
></article-photo>

<hgroup>
<h1 @text="title"></h1>
<p webc:if="subhead" @text="subhead"></p>
<h1 @text="article.title"></h1>
<p webc:if="article.subhead" @text="article.subhead"></p>
</hgroup>

<p class="meta">
<a :href="author.url" class="avatar">
<pho-picture :@id="author.photo" @renditions="sm"></pho-picture>
<a :href="$data.authors[article.author].url" class="avatar">
<pho-picture
:@id="$data.authors[article.author].photo"
@renditions="sm"
></pho-picture>
</a>
<a rel="author" :href="author.url" @text="author.name"></a>
<a
rel="author"
:href="$data.authors[article.author].url"
@text="$data.authors[article.author].name"
></a>
<time
:datetime="date.toISOString()"
@text="date.toLocaleDateString('en-us', { dateStyle: 'medium' })"
:datetime="article.page.date.toISOString()"
@text="article.page.date.toLocaleDateString('en-us', { dateStyle: 'medium' })"
></time>
</p>
</header>
Expand Down
8 changes: 1 addition & 7 deletions www/_includes/layouts/article.webc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ layout: page
---

<article>
<article-header
:@hero="hero"
:@title="title"
:@subhead="subhead"
:@author="$data.authors[author]"
:@date="$data.page.date"
></article-header>
<article-header :@article="$data"></article-header>

<div @raw="content" webc:nokeep></div>

Expand Down
8 changes: 1 addition & 7 deletions www/_includes/layouts/video.webc
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ layout: page
<article>
<article-vod :@id="vod.id" :@alt="vod.alt"></article-vod>

<article-header
:@hero="hero"
:@title="title"
:@subhead="subhead"
:@author="$data.authors[author]"
:@date="$data.page.date"
></article-header>
<article-header :@article="$data"></article-header>

<div @raw="content" webc:nokeep></div>
</article>
Expand Down

0 comments on commit dba042d

Please sign in to comment.