Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin committed Jan 4, 2024
1 parent e0ed94c commit 72aa7f0
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/app/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { permanentRedirect } from "next/navigation";
import { ContentResponse, Content } from '../../models/models';
import { findByPath } from '../../api/content';
import { asInsight } from '../../utils/converters';
import { sluggize } from "../../utils/slug";
import { Renderer } from './renderer';
import { runOrHandleErrorIf, throwIfError } from "../handler";

Expand Down Expand Up @@ -47,7 +48,7 @@ async function get(req: any) {

return {
props: {
slug: req.params.slug.join('/'),
slug: sluggize(req.params.slug),
content: content,
insight: asInsight(response)
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/articles/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ContentResponse, Content } from '../../../models/models';
import { isIgnoreRequest } from '../../../utils/filterRequests';
import { findByPath } from '../../../api/content';
import { asInsight } from '../../../utils/converters';
import { sluggize } from "../../../utils/slug";
import { Renderer } from './renderer';
import { runOrHandleErrorIf, throwIfError } from "../../handler";

Expand Down Expand Up @@ -45,7 +46,7 @@ async function get(req: any) {

return {
props: {
slug: 'articles/' + req.params.slug.join('/'),
slug: sluggize(req.params.slug, 'articles'),
content: content,
insight: asInsight(response)
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/articles/[number]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { getArticles } from '../../../api/articles';
import { Article, ArticleResponseWithCount } from '../../../models/models';
import { getRequestContext } from '../../../utils/requestContext';
import { sluggize } from "../../../utils/slug";
import { Renderer } from './renderer';
import { runOrHandleErrorIf, throwIfError } from "../../handler";

Expand Down Expand Up @@ -36,7 +37,7 @@ async function get(req: any) {

return {
props: {
slug: req.params.slug.join('/'),
slug: sluggize(req.params.slug),
current: req.params.number,
count: articlesResponseWithCount.count,
articles: articles
Expand Down
1 change: 0 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default function RootLayout({
const theme = getThemeSetting();
return (
<html lang={lang}>
<head />
<body data-theme={`${theme}`}>
<ClientLayout>
{ children }
Expand Down
3 changes: 2 additions & 1 deletion src/app/series/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SeriresWithArticles
} from '../../../models/models';
import { getRequestContext } from '../../../utils/requestContext';
import { sluggize } from "../../../utils/slug";
import { Renderer } from './renderer';
import { runOrHandleErrorIf, throwIfError } from "../../handler";

Expand Down Expand Up @@ -42,7 +43,7 @@ async function get(req: any) {

return {
props: {
slug: req.params.slug.join('/'),
slug: sluggize(req.params.slug),
seriresWithArticles: seriresWithArticles
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/series/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { getSeries } from '../../api/series';
import { Series, SeriesResponse } from '../../models/models';
import { getRequestContext } from '../../utils/requestContext';
import { sluggize } from "../../utils/slug";
import { Renderer } from './renderer';
import { runOrHandleErrorIf, throwIfError } from "../handler";

Expand Down Expand Up @@ -32,7 +33,7 @@ async function get(req: any) {

return {
props: {
slug: req.params.slug.join('/'),
slug: sluggize(req.params.slug),
series: series
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/status/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { getStatus } from '../../api/status';
import { getRequestContext } from '../../utils/requestContext';
import { sluggize } from "../../utils/slug";
import { Renderer } from './renderer';

export default async function Page(req: any) {
Expand All @@ -14,7 +15,7 @@ async function get(req: any) {

return {
props: {
slug: req.params.slug.join('/'),
slug: sluggize(req.params.slug),
statusCode: response.status
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/tags/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { getArticlesByTagName } from '../../../api/articles';
import { Article, ArticleResponseWithCount } from '../../../models/models';
import { getRequestContext } from '../../../utils/requestContext';
import { sluggize } from "../../../utils/slug";
import { Renderer } from './renderer';
import { runOrHandleErrorIf, throwIfError } from "../../handler";

Expand Down Expand Up @@ -38,7 +39,7 @@ async function get(req: any) {

return {
props: {
slug: req.params.slug.join('/'),
slug: sluggize(req.params.slug),
tagName: tagName,
currentPage: currentPage,
count: articlesResponseWithCount.count,
Expand Down
3 changes: 2 additions & 1 deletion src/app/tags/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Tag } from '../../models/models';
import { getTags } from '../../api/tags';
import { getRequestContext } from '../../utils/requestContext';
import { sluggize } from "../../utils/slug";
import { Renderer } from './renderer';
import { runOrHandleErrorIf, throwIfError } from "../handler";

Expand All @@ -21,7 +22,7 @@ async function get(req: any) {

return {
props: {
slug: req.params.slug.join('/'),
slug: sluggize(req.params.slug),
tags: await response.json() as Array<Tag>
}
}
Expand Down
1 change: 0 additions & 1 deletion src/utils/slug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export function sluggize(
fallback: string | undefined = undefined
) {
try {
console.log()
if (slug instanceof Array) {
const p = prefix === undefined ? undefined : '/' + prefix;
const s = slug as Array<string>;
Expand Down

0 comments on commit 72aa7f0

Please sign in to comment.