2020-06-14
Notionããã°ãäœããŸãã ð
åã¯ãããŸã§ã¢ãŠãããã㯠Qiita ãã¡ã€ã³ã«ããŠããŸããã
æè¡çãªçºä¿¡ã¯ Qiitaããã以å€ã®ã¢ãŠãããã㯠Medium ã«ãã£ãŠæãã§ããããMedium ã¯ã©ã¡ãããšãããšQiitaã®è±èªçèšäºãæžãåºãããžã·ã§ã³ã§äœ¿ããããŠãŸããã
å人ã®ã©ã€ãããã¯ãä»åŸNoteãããã«æžããããªãšæã£ãŠãã®ã§ãããè¿é Notionããã°ãæµè¡ã£ãŠããã®ã§æã䌞ã°ããŠã¿ãŸããã
Notionããã°ãšããŠæ€çŽ¢ãããšåãã«ãããããã®ã ZEIT補 Notion Blog ã§ããã
ãã® ZEIT ã¯éãšã³ãžãã¢ã§ãã»ããã¢ããã容æã«ã§ããããããã¹ãããªããŒã«ãšãªã£ãŠããŸãã
ïŒã§ããåã¯è©°ãŸããŸãããŸãããð€ïŒ
æ¢ã«ããã€ã解説èšäºãããã®ã§èŠç¹ã ããŸãšãããšã
ãšããæãã§ãããããªã«ãã£ãŠãããæãããã¡ãè¯ãã§ãã
åãäž»ã«è©°ãŸã£ãã®ã¯ããã
Notion ãžã®ããŒã¿ã¢ã¯ã»ã¹ã« NOTION_TOKEN ãš BLOG_INDEX_ID ã䜿çšãã
ããã£ãç¹
ããããååã«ããŒã¿ç°å¢å€æ°ç»é²ããã¹ã£ãŠããŸã£ãã®ãæ²ãã¿ã®å§ãŸããªã®ã§ãããZEITäžã§ NOTION_TOKEN ãš BLOG_INDEX_ID ãééããŠããŸããšãGUIäžããã¯å€æŽã§ããŸããã
now CLI
ã䜿çšããªããã°ã·ãŒã¯ã¬ããããŒã¿ã¯åé€äžå¯èœã§ãã
æ¢ã«åãååã®ãããžã§ã¯ãã¯ååšããŠããŸããšæããã»ã»ã»
BLOG_INDEX_IDãèªã¿åããªããšãããã»ã»ã»ïŒããŒã«ã«èµ·åã§ã¯åç §ã§ãããïŒïŒïŒïŒïŒïŒãªãããã«ããŠããïŒïŒïŒïŒïŒ
ïŒãšã©ãŒãèµ·ããŠããªããžããªã¯äœæãããŠããŸãã»ã»ã»ïŒ
ã»ã»ã»
ãªããžããªãæ¶ãçŽããããã·ãŒã¯ã¬ãããåé€ãããããŠããšã©ãŒããéããããªããªã£ãŠããŸã£ãã®ã§ãèããããšãæŸæ£ããŸãããð€
ZEITïŒVercelïŒç°å¢åããªãïŒïŒãããããªãïŒïŒã£ãŠããããããããŠãã®ã§ã䜿ãæ £ããŠãNetlifyã§è©Šãããšã«ããŸããã
Gatsbyã§ã¯NotionããŒã¿ã«ã¢ã¯ã»ã¹ãããã©ã°ã€ã³ãããããã§ã解説èšäºãããã€ãããããã§ãã
ïŒçŸè·ã§ã¯Gatsbyã䜿ã£ãŠããããã®ã§å®å¿æãããã»ã»ã»ïŒïŒ
ãã®èšäºã§èªãããŠããæé ã¯
gaysby develop
ããã ãïŒGatsbyã®ã¹ã¿ãŒã¿ãŒãããã䜿ã£ãŠäœæããããšãå¯èœã§ãZEITã®åºå®ãã³ãã¬ãŒãã«æ¯ã¹ãŠãã¶ã€ã³ã®éžæè¢ãããã®ãããã ïŒã«ã¹ã¿ãã€ãºãããããã ããªãã§ããã©ãããã©ãããããªã®ã§ã»ã»ã»ãïŒ
ãŸãããã®ãã©ã°ã€ã³ã§äœ¿ãã®ã¯Notionã®Database URLã§ãã ïŒâããããã®ïŒ
https://www.notion.so/1aa283fcd5ae4a73ba0f73c062de745e?v=8f1bcd444edb4360aa2b090a2934bd62
ããã¯database ã® shareããå ¬éãããšãã®URLã§ãã
ZEITã§ã¯TOKENãæ±ããããã®ã§ããŒã«ã«ç°å¢ã®ã»ããã¢ãããæ°ã䜿ãã®ã§ããããã¡ãã¯ãã ã®å ¬éURLãªã®ã§ã»ãã¥ãªãã£ãæ°ã«ããªããŠããã§ããã
Gatsby ã®ã¯ãšãªãã¡ãããšäœ¿ã£ãããšããªãã£ãã®ã§æåã¯ãªããŸããã§ããããããã°èšäºã®ã«ããŽãªãŒãªã©ãã¯ãšãªã§ãã£ã«ã¿ãŒããããšã§ããŸãåé¡åãããããšãã§ãããã§ããã³ã³ãã³ããå¢ããããããã§ãã
ã¯ãšãªãšComponentãé£ãéããšãšã©ãŒãã§ãŠäœããªãã ãããããªãã§ããã http://localhost:8000/___graphql
ã§ã¯ãšãªã®åäœç¢ºèªãç°¡åã«ã§ããŸãã
ããŒã«ã«ã§ã®æ€èšŒãæžãã ãã€ãã¯Netlifyã§ãã
ããã°ã«äœ¿ããããªãã¡ã€ã³ãæã£ãŠãªãã£ãã®ã§ãåããŸããã
Google Domainã䜿ã£ãŠ nitaking.dev
ã賌å
¥ããŸãã
ãåå.comã§ãã¡ã€ã³è²·ã£ãŠããããŸããããGoogle Domainãã£ã¡ãUI楜ãïŒã£ãŠããã¡ã€ã³çéã®UIã®æªãã¯ãªããªãã ïŒïŒ
ç¡äºè³Œå ¥ã§ããããŸãNetlifyãžã
Overview > Domain setttings > Add Domain alias
ãã䜿çšããããã¡ã€ã³ãå ¥åããŸãã
DNSãããã€ãã«CNAMEãèšå®ããŠããšèšãããã®ã§Google Domainã«æ»ããŸãã
DNS > ã«ã¹ã¿ã ãªãœãŒã¹ ã¬ã³ãŒã > è¿œå
㧠åå ãš ããŒã¿ ãã»ããããŠè¿œå ããŸãã
ååããµããã¡ã€ã³ãããŒã¿ã¯Netlifyäžã§ã®URLã§ãã
ãããšãæ°æéãããã§DNSã®åæ ãè¡ãããŠãèšå®ããURLã§Netlifyã«ãã¹ãã£ã³ã°ããããµã€ãã«ã¢ã¯ã»ã¹ãã§ããããã«ãªããŸãã ïŒåã¯10ã20åã§åæ ãããŸãããæã¯æ°æéããã£ããã©ãã¡ãæ©ããGoogleã®ããŒã ãµãŒããŒã®ãããïŒïŒ
ãããªãããªã§ Gatsby 㧠Notion Blog ã»ããã¢ããã§ããŸããðð
GitHubã«ãœãŒã¹å ¬éããŠããã®ã§ãæ°ã«ãªãæ¹ã¯ãã¡ãããã