export const getStaticPaths = async() =>{ // dataã«ã¨ã³ããã¤ã³ãblogã®æ å ±ãåå¾ãã const data = await client.get({endpoint: "blog"}); // pathsã«dataããåãåºããidãURLã¨ãã¦ä»£å ¥ãã const paths = data.contents.map((content) => `/blog/${content.id}`); // fallbackãfalseã«ããã¨pathsã§è¿ããURL以å¤404ã« return {paths, fallback: false}; } getStaticPropsã®å¼ç¨ contextãã©ã¡ã¼ã¿ã¯æ¬¡ã®ãã¼ãå«ããªãã¸ã§ã¯ãã§ã: paramsã¯ãã¼ã¸ãåçã«ã¼ããå©ç¨ããããã®ã«ã¼ããã©ã¡ã¼ã¿ãæã¡ã¾ãããã¨ãã°ããã¼ã¸åã [id]
import Document, { Head, Html, Main, NextScript } from "next/document"; // class Document extends NextDocument { class MyDocument extends Document { render() { return ( <Html> <Head> <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100;300;400;500;600;700&display=swap" rel="stylesheet" /> </Head> <body> <Main /> <NextScript /> </body> </Html> ); } } export default MyDocument;
Font Optimization next/font will automatically optimize your fonts (including custom fonts) and remove external network requests for improved privacy and performance. ð¥ Watch: Learn more about using next/font â YouTube (6 minutes). next/font includes built-in automatic self-hosting for any font file. This means you can optimally load web fonts with zero layout shift, thanks to the underlying CSS
æ¥ä»ã2023-01-29T00:30:00.000Zãããªæããªãã ãã©ãè¦ãããæ´ãããªãããªã ä»åã¯Day.jsã使ã£ãæ¹æ³ãç´¹ä»ãã¾ãã 2023å¹´01æ29æ¥âãããªæãã«å¤æãã¦ããã¾ãããã React Next.jsã§microCMSããããã°è¨äºãåå¾ãã¦ãããããªã±ã¼ã¹ãæ³å®ãã¦è§£èª¬ãã¦ãã¾ãã å ¨ä½å ããã¸ã§ã¯ãã«Day.jsãã¤ã³ã¹ãã¼ã«ãã æ¥ä»å¤æç¨ã®ã³ã³ãã¼ãã³ããä½æãã ãã©ã¼ãããããããã¼ã¸ã§ã®è¨è¿°æ¹æ³ ãããã¨ã¯ãã£ããã¨ãããªæãã§ãã çããåãã£ã¦ããã¨æ©ãã®ã§ãããèªåã§ã¼ããã対å¿ããã¨æéãããã¾ããããã Day.jsãã¤ã³ã¹ãã¼ã«ãã
ã¿ãªããããã«ã¡ã¯ã æ ªå¼ä¼ç¤¾BeatFitã§CTOããã¦ããã飯å¡ã¨ç³ãã¾ãã ç§éã¯2021å¹´4æãããmicroCMSãReact Nativeã¢ããªã«å°å ¥ãã¾ããã 詳細ã«ã¤ãã¾ãã¦ã¯ããã¡ãã®è¨äºãã覧ãã ããã ä»åéçºããã¦ããä¸ã§ããããããªå ´æã§ããã£ã¦ãã¾ãã¾ããã Jamstackã®ç¥è¦ä¸è¶³ããwriteè¦ä»¶ãè¦ããè¤éãªè¨è¨ã«é£æ¸ãããã¨ã主ãªçç±ã§ãããããããå°ã£ãæã«åç §ããè³æãå°ãªãã£ããã¨ãè¾ãã¨ããã§ããã ReactãVueã¨éããReact Nativeèªä½ãããã¾ã§åºãæ®åãã¦ããªããã¨ãå½ç£CMSã®ããæµ·å¤äºä¾ãã»ã¨ãã©è¦å½ãããªãããã¨èãããã¾ããã æ¬è¨äºããä»å¾ React Nativeã«microCMSãå°å ¥ãããã¨èãã¦ããéçºè ã®çãã¾ã«ãå°ãã§ããå½¹ã«ãªãã°å¹¸ãã§ãã åæä¸è¨ã®ãã¼ã¸ã§ã³ã§éçºãè¡ã£ã¦ãã¾ãããã¼ã¸ã§ã³ã®å·®ç°ã«
ããã«ã¡ã¯ã æ¬æ¥ã®microCMSã®æ´æ°æ å ±ããç¥ãããã¾ãã å¤æ´å 容ãªããã¨ãã£ã¿ã®ã¬ã¹ãã³ã¹å½¢å¼ã¨ãã¦ãªãã¸ã§ã¯ãåããå©ç¨ããã ããããã«ãªãã¾ããã ãªããã¨ãã£ã¿ã®ã¬ã¹ãã³ã¹ã¯ããã¾ã§HTMLã§ã®è¿å´ã§ãããããããæ§é åããããªãã¸ã§ã¯ãå½¢å¼ã§åå¾ã§ããããã«ãªãã¾ãã ã¢ãã¤ã«ã¢ããªãªã©ã§HTMLããã¥ã¡ã³ãã§ã¯ãã³ããªã³ã°ãã«ããå ´åããå ¥ç¨¿ããå 容ãé«åº¦ã«æ±ãããï¼ä¸é¨ã ãç¬èªã®ã¹ã¿ã¤ã«ãå½ã¦ããªã©ï¼å ´åã«ä¾¿å©ã§ãã â»ç¾ç¶ãã¼ã¿çã¨ãã¦ã®ãæä¾ã¨ãªãã¾ããæ¬ãªãªã¼ã¹ã¾ã§ã«ä»æ§ãå¤æ´ãããå¯è½æ§ãããã¾ãã ãå©ç¨æ¹æ³APIãªã¯ã¨ã¹ãæã®ãã©ã¡ã¼ã¿ã« richEditorFormat ãæå®ãããã¨ã§ãå©ç¨ããã ãã¾ãã html ãæå®ï¼ããã©ã«ãï¼richEditorFormatã« html ãæå®ããå ´åãããã¾ã§éãHTMLã¨ãã¦åå¾ã§ãã¾ãã ããã©ã«ãã®è¨
æ¦è¦microCMS ã§ã¯ããã°ãªã©ã®è¨äºãã¼ã¿ããªããã¨ãã£ã¿ã§å ¥ç¨¿ãããã¨ãå¯è½ã§ãããã ãAPIã§ã¯ããããçHTMLã§è¿ã£ã¦ãã¾ãã dangerouslySetInnerHTML ã«æ¸¡ãã°ã¬ã³ããªã³ã°ããã¾ããã以ä¸ã®ãããªã±ã¼ã¹ãããã¨æãã¾ãã Chakra UI ãªã©ã®å®ç¾©ããã¦ããã³ã³ãã¼ãã³ããå©ç¨ãããclassæå®ãã¦ã°ãã¼ãã«CSSãæ¸ããããªãXSSã®å±éºæ§ãããããdangerouslySetInnerHTMLãå©ç¨ããããªã ä»åã¯ãããã解決ããhtml-react-parserãå©ç¨ãã¦ããã¾ãããµã³ãã«ã³ã¼ãã¯ãã¡ããmicroCMSã®åå¾å¦çã¯çç¥ãã¦ãã¾ãã å®è¡ç°å¢ãµã³ãã«ã¨ãã¦ãNext.js 㨠Chakra UI ãå©ç¨ãã¾ãã html-react-parserã¨ã¯html-react-parser ã¯Reactã§çHTMLãèªç±ã«å å·¥ã
Error: Objects are not valid as a React child (found: object with keys {id, name, slug}). If you meant to render a collection of children, use an array instead. å訳ããã¨ããªãã¸ã§ã¯ãã¯Reactã®Childã¨ãã¦ç¸å¿ãããªãããkeyã{id, name, slug}ã§ãããªãã¸ã§ã¯ããè¦ã¤ãã£ããã ãããchildrenã®ã³ã¬ã¯ã·ã§ã³ã¨ãã¦ã¬ã³ãã¼ããããã ã£ãããArrayã代ããã«ä½¿ã£ã¦ããã¨ããæããã èªåã®å ´åãã®{id, name, slug}ã¨ã¯productãæã¤åç §ããããã£brand: DocumentRefferenceã®Valueã®ãã¨ãªãã§ãããçµè«ããè¨ãã¨ãããã³ãå´ã®ã³ã¼ã㧠name ã§ã¯ãªã
1. æ¦è¦ microCMSã¯å½ç£ã®ãããã¬ã¹CMSã§ãã WordPressã®ç®¡çç»é¢å´ã®ã¿ã®æ©è½ãæä¾ãã¦ãããããªãµã¼ãã¹ã§ããã¼ã¿ã管çããããã®ç®¡çç»é¢ã¨ç»é²ãããã¼ã¿ãåå¾ããããã®APIãæä¾ãã¦ãããJamstackãSSGã§Webãµã¤ããå¶ä½ããéã«ããå©ç¨ããã¦ãã¾ãã microCMSï½APIãã¼ã¹ã®æ¥æ¬è£½ãããã¬ã¹CMS 2. APIãä½æãã¦ã¿ã ã¢ã«ã¦ã³ãã®ç»é²ãããã¸ã§ã¯ãã®ä½æã«ã¤ãã¦ã¯ãç»é¢ã®æé éãé²ããã°ããã®ã§çç¥ã ã¢ã«ã¦ã³ããä½æããå¾ã管çç»é¢ã«ã¢ã¯ã»ã¹ããã¨ä»¥ä¸ã®ããã«è¡¨ç¤ºãããã¨æãã¾ãã microCMSã§ã¯2022å¹´4æã«ãªãªã¼ã¹ãããAPIãã³ãã¬ã¼ãæ©è½ã使ç¨ãã¦ãç¨éã«åã£ãAPIãç°¡åã«çæãããã¨ãã§ãã¾ãã APIã1ã¯ãªãã¯ã§çæã§ãããAPIãã³ãã¬ã¼ããæ©è½ããªãªã¼ã¹ãã¾ãã ä»å¹´ã¯å人ã®æè¡ããã°ã§ãä½ãããã¨æã£ã¦
æ¦è¦ ããã«ã¡ã¯ãé½å ã§ããã³ãã¨ã³ãã¨ã³ã¸ãã¢ããã¦ã¾ãããã½ãã§ããå æ¥ã便å©ãªãã¼ã«ããéçºããªããã¨ã§æåãªãã®ZEITã®ååãå¤ããVercelã«ãªã£ããã¨ãããã¥ã¼ã¹ã¯è¨æ¶ã«æ°ãããã¨æãã¾ããã©ãã©ã使ãåæããããªã£ã¦ããã¨ãããã¨ã§æ³¨ç®ãã¦ããããããã§ãããæ¨ä»ã§ã¯javascrptãããã¯typescriptãä¸å¿ã¨ããã¢ããªã±ã¼ã·ã§ã³ã主æµã«ãªã£ã¦ããä¸ã§ãjamstackã¨å¼ã°ããã¢ã¼ããã¯ãã£ã注ç®ããã¦ããã¨æãã¾ããjamstackèªä½ã¯éå»ã«å·çããè¨äºã§ãç´¹ä»ãã¦ãã¦ãåºç¤çãªå 容ã¯ãã¡ãã§ç¢ºèªãã¦ã¿ã¦ãã ããã 以åã¯Nuxt.js + Contentful + Netlifyã®çµã¿åããã§ãã£ã¦ã¿ã¾ããããä»åã¯Vercelã®ãããã¯ãã¨å½ç£ã®ãããã¬ã¹CMSã§æåãªmicro CMSã使ã£ã¦ãjamstackãªããã°ãµã¤ããä½ã£ã¦ã¿ããã¨æãã¾ãã
ããããã¦ã§ããµã¤ãå¶ä½ãå¦ã³å§ããé ã¯ãCMSãå¿ è¦ãªã¦ã§ããµã¤ãã®å¶ä½æ段ã¨ããã°WordPressã第ä¸é¸æã¨ããå°è±¡ã§ããã ãããè¿é ã¯ãããã¬ã¹CMSã®ç»å ´ãJamstackã®æ®åã«ãã£ã¦ãCMSãã¦ã§ããµã¤ããä½ããã¬ã¼ã ã¯ã¼ã¯ãé¸æè¢ãããè±å¯ã«ãªã£ã¦ãã¦ãã¾ãã neccoã§ã¯ã¢ãã³ãªå®è£ æ¹æ³ãåãå ¥ãã¦ããæ¹éã§ãããæè¿ã¯Next.jsãªã©ã使ã£ã¦éçºããæ©ä¼ãå¢ãã¦ãã¾ãããããã§ä»åãmicroCMS + Next.jsã§Jamstackããã°ãä½ã£ã¦ã¿ãããã«ææ¦ãã¦ã¿ã¾ããã ãã®è¨äºãèªãã§ããæ¹ããä¸åº¦ã¯Next.jsãmicroCMSãå©ç¨ãã¦æ§ç¯ããããµã¤ããè¦ããããã¨ãããã®ã§ã¯ãªãã§ããããã Next.jsã¯Node.jsãªã©ã®éçºç°å¢ãããã°ç°¡åã«å§ããããã®ã§ãã£ã¦ã¿ã¾ãããï¼ ä»åä½ã£ããµã¤ãã®æ§æ ãã¥ã¼ããªã¢ã«ã®ã¿ã¤ãã«ã«ãããããã«
æ¦è¦ microCMSãNext.jsï¼TypeScriptï¼ã使ã£ã¦ããã°ãµã¤ããä½æããæé ã¨ã追å ã§å®è£ ããæ©è½ã«ã¤ãã¦ãã¾ããã®éç¨ã§å¦ãã ãã¨ã®åå¿é²è¨äºã§ãã åºæ¬çã«ã¯å ¬å¼ã®ãã¥ã¼ããªã¢ã«éãã«é²ãã¦ãã¾ãããTypeScriptã®åä»ããè¨äºå ã®ã³ã¼ããããã¯ã®ãã¤ã©ã¤ããªã©è©°ã¾ã£ãç®æããã£ãã®ã§ãã¾ã¨ãã¦ããããã¨æãã¾ãã ãããã¤URL GitHub â»ãã®è¨äºã§ã¯ã¹ã¿ã¤ãªã³ã°ã«ã¤ãã¦ã¯è§£èª¬ãã¾ããã MaterialUIã主ã«ä½¿ç¨ãã¦ã¹ã¿ã¤ãªã³ã°ãè¡ã£ã¦ããã®ã§ã詳ããã³ã¼ãã¯GitHubãã覧ããã ããã°ã¨æãã¾ãã 使ç¨æè¡ Next.jsã12.0.10 Reactã17.0.2 TypeScriptã4.5.5 ESLintã8.8.0 prettierã2.5.1 å ¨ä½ã®æµã microCMSã®æºåï¼ã¢ã«ã¦ã³ãä½æã»è¨äºã³ã³ãã³ãã®APIä½æï¼ Next
ããã«ã¡ã¯hiro08ã§ãã ç¾å¨ããã³ãã¨ã³ãã¨ã³ã¸ãã¢ã¨ãã¦microCMSæ¬ä½ã®éçºã«æºãã£ã¦ãã¦ãæ¥ã ãµã¼ãã¹ã®æ°æ©è½éçºãæ¹åãè¡ã£ã¦ãã¾ãã ããã¦ãå æ¥ãªãªã¼ã¹ãããmicroCMSã®JavaScriptãiOSãAndroid SDKã®3ã¤ã®ãã¡ãJavaScript SDKã®éçºãæ å½ããã¦é ãã¾ããããªãªã¼ã¹æã®ããã°ã¯ãã¡ãã§ãã microcms-js-sdkã¯npmã§é å¸ããã¦ãã¦ãGitHubã«ãªã¼ãã³ã½ã¼ã¹ã¨ãã¦å ¬éããã¦ãã¾ãã â»ç¾å¨ã¯Getãªã¯ã¨ã¹ãã®ã¿ã«å¯¾å¿ãã¦ãã¾ããä»å¾ãæ©è½è¿½å ãæ¹åãã¦ããäºå®ã§ãã SDKãç¨ãã¦éçºããã¡ãªããã¨ãã¦ã¯ãFetch APIãXMLHttpRequestçã®ãããã¯ã¼ã¯éä¿¡ã«é¢ããå¦çãé è½ã§ãããã¨ã«ããã¾ããåé·çã«ãªããã¡ãªãªã¯ã¨ã¹ãå¦çããã¡ã½ããåãããã¨ã«ãã£ã¦ä¸è²«æ§ããããã¯ãªã¼ã³ãªã³ã¼ããæ¸ãã
ãã®noteã®å¯¾è±¡è ï¼ - Headless CMSã¨ããã®ãèãããã¨ãããï¼ãããã¯åå¼·ãããï¼ - ã¨ã³ã¸ãã¢ã§ã¯ãªãã®ã§ãå°éç¨èªé£ãã - ç°¡åã«Headless CMSã®ä½¿ãæ¹ãç¥ãããã ã注æã ãã®noteã®æ å ±ã¯å¤ãå¯è½æ§ãããã¾ããæ£ç¢ºãªMicro CMSã®æ å ±ã¯ãMicro CMSã®å ¬å¼ããã¥ã¡ã³ããã確èªãã ããã ãHeadless CMSã¨ã¯ï¼ããMicro CMSã¨ã¯ï¼ããMicro CMSã®å©ç¨æ¹æ³ã- Headless CMSã¨ã¯ Headless CMSã¨ã¯ä½ããMicro CMSã®æ¹ãæ¸ãã¦ãããã¡ãã®ããã°ãããããããã£ãã§ãã Micro CMSã¯æ¥æ¬èªã§ãããã¨ã¨ãããç¨åº¦ããã¥ã¢ã«ãã¾ã¨ã¾ã£ã¦ããã®ã§ãããã¥ã¡ã³ã確èªãã¦ããã ããã°åºæ¬çã«ã¯ç解ã§ããã¨æãã¾ãã ããããã¯ã使ã£ã¦ãã¦æ°ã«ãªã£ãããç§èªèº«ãæ¢ã¾ã£ã¦ãã¾ã£ãç®æãç´°ãå ¥ã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}