Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: keywords support for tutorials; Release notes Change #52

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion src/components/PageHeader.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ interface TabProps {
interface Props {
title: string;
showRSS?: boolean;
showTimeline?: boolean;
description?: any;
tabs?: TabProps[];
breadcrumb?: TabProps[];
className?: string;
}

const { showRSS, className, title, description, tabs, breadcrumb } = Astro.props;
const { showRSS, showTimeline = false, className, title, description, tabs, breadcrumb } = Astro.props;
const items = tabs || breadcrumb || [];
---

Expand Down Expand Up @@ -53,6 +54,38 @@ const items = tabs || breadcrumb || [];
</a>
)
}
{
showTimeline && (
<a
href={
Astro.url.pathname.includes("/blog/timeline")
? Astro.url.pathname.startsWith("/cn/")
? "/cn/blog/tags/release-notes"
: Astro.url.pathname.startsWith("/ja/")
? "/ja/blog/tags/release-notes"
: "/en/blog/tags/release-notes"
: Astro.url.pathname.startsWith("/cn/")
? "/cn/blog/timeline"
: Astro.url.pathname.startsWith("/ja/")
? "/ja/blog/timeline"
: "/en/blog/timeline"
}
>
<svg
style="zoom: 1.5; margin-top: -3px;"
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
fill="currentColor"
class="bi bi-arrow-repeat"
viewBox="0 0 16 16"
>
<path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z"/>
<path fill-rule="evenodd" d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z"/>
</svg>
</a>
)
}
</h1>
<p class="para-desc mx-auto text-muted">
{description}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/cn/blog/tags/[slug]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const socialLinks = [
---

<Layout title={title} description={description} keywords={keywords}>
<PageHeader showRSS title={title} description={description} breadcrumb={tabs}>
<PageHeader showRSS showTimeline={slug === 'release-notes'} title={title} description={description} breadcrumb={tabs}>
</PageHeader>
<section class="section">
<div class="container">
Expand Down
3 changes: 2 additions & 1 deletion src/pages/cn/blog/tags/[slug]/page/[page].astro
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const socialLinks = [
---

<Layout title={title} description={description} keywords={keywords}>
<PageHeader showRSS title={title} description={description} breadcrumb={tabs}></PageHeader>
<PageHeader showRSS showTimeline={slug === 'release-notes'} title={title} description={description} breadcrumb={tabs}></PageHeader>
<section class="section">
<div class="container">
<div class="row">
Expand Down Expand Up @@ -91,6 +91,7 @@ const socialLinks = [
basepath={basepath}
socialLinks={socialLinks}
lang="cn"
description={description}
/>
</div>

Expand Down
1 change: 1 addition & 0 deletions src/pages/cn/blog/timeline.astro
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const tabs = [
<Layout title="发布日志" description={description}>
<PageHeader
title="发布日志"
showTimeline={true}
description={description}
breadcrumb={tabs}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/cn/tutorials/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ if (!data) {
return new Response("Not found", { status: 404 });
}
const title = data.title_cn || data.title;
const keywords = (data.tags || [])
.map((tag: any) => tag.title_cn || tag.title)
const keywords = (data.keywords || [])
.map((keywords: any) => keywords.title_cn || keywords.title)
.join(",");
const description = data.description_cn || data.description;
const basepath = "/cn/tutorials";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/en/blog/tags/[slug]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const socialLinks = [
---

<Layout title={title} description={description} keywords={keywords}>
<PageHeader showRSS title={title} description={description} breadcrumb={tabs}>
<PageHeader showRSS showTimeline={slug === 'release-notes'} title={title} description={description} breadcrumb={tabs}>
</PageHeader>
<section class="section">
<div class="container">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/en/blog/tags/[slug]/page/[page].astro
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const socialLinks = [
---

<Layout title={title} description={description} keywords={keywords}>
<PageHeader showRSS title={title} description={description} breadcrumb={tabs}>
<PageHeader showRSS showTimeline={slug === 'release-notes'} title={title} description={description} breadcrumb={tabs}></PageHeader>
</PageHeader>
<section class="section">
<div class="container">
Expand Down
1 change: 1 addition & 0 deletions src/pages/en/blog/timeline.astro
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const tabs = [
<Layout title="Release Notes" description={description}>
<PageHeader
title="Release Notes"
showTimeline={true}
description={description}
breadcrumb={tabs}
/>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/en/tutorials/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ if (!data) {
return new Response("Not found", { status: 404 });
}
const title = data.title;
const keywords = (data.tags || []).map((tag: any) => tag.title).join(",");
const keywords = (data.tags || [])
.map((keywords: any) => keywords.title)
.join(",");
const description = data.description;
const basepath = "/en/tutorials";
const tabs = [
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ja/blog/tags/[slug]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const socialLinks = [
---

<Layout title={title} description={description} keywords={keywords}>
<PageHeader showRSS title={title} description={description} breadcrumb={tabs}>
<PageHeader showRSS showTimeline={slug === 'release-notes'} title={title} description={description} breadcrumb={tabs}>
</PageHeader>
<section class="section">
<div class="container">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ja/blog/tags/[slug]/page/[page].astro
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const socialLinks = [
---

<Layout title={title} description={description} keywords={keywords}>
<PageHeader showRSS title={title} description={description} breadcrumb={tabs}></PageHeader>
<PageHeader showRSS showTimeline={slug === 'release-notes'} title={title} description={description} breadcrumb={tabs}></PageHeader>
<section class="section">
<div class="container">
<div class="row">
Expand Down
1 change: 1 addition & 0 deletions src/pages/ja/blog/timeline.astro
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const tabs = [
<Layout title="リリースノート " description={description}>
<PageHeader
title="リリースノート "
showTimeline={true}
description={description}
breadcrumb={tabs}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ja/tutorials/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (!data) {
return new Response("Not found", { status: 404 });
}
const title = data.title_ja || data.title;
const keywords = (data.tags || []).map((tag: any) => tag.title_ja || tag.title).join(",");
const keywords = (data.keywords || []).map((keywords: any) => keywords.title_ja || keywords.title).join(",");
const description = data.description_ja || data.description;
const basepath = "/ja/tutorials";
const tabs = [
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export async function getTutorialArticle(slug?: string, locale = 'en') {
if (!slug) {
return {};
}
const res = await fetch(`${baseURL}tutorialArticles:get?appends=serials&filter[slug]=${slug}&token=${token}`);
const res = await fetch(`${baseURL}tutorialArticles:get?appends=serials,keywords&filter[slug]=${slug}&token=${token}`);
const body = await res.json();
const data = body.data || {};
if (!data.id) {
Expand Down