· 12 min read
test-post
Default contentx

image: /../src/assets/images/3993798_print_1.png
#@image: /src/assets/images/3993798_print_1.png
#@image: ~/assets/images/3993798_print_1.png
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
Headings
Sint sit cillum pariatur eiusmod nulla pariatur ipsum. Sit laborum anim qui mollit tempor pariatur nisi minim dolor. Aliquip et adipisicing sit sit fugiat commodo id sunt. Nostrud enim ad commodo incididunt cupidatat in ullamco ullamco Lorem cupidatat velit enim et Lorem. Ut laborum cillum laboris fugiat culpa sint irure do reprehenderit culpa occaecat. Exercitation esse mollit tempor magna aliqua in occaecat aliquip veniam reprehenderit nisi dolor in laboris dolore velit.
”A content model is nothing until it has content and a frontend. In the last part of this series, we explored a basic schema and content model for a learning platform with Hygraph. In this article, we’ll take that schema and produce a Next.js site using data from Hygraph.\n\nSeries:\n\n- [Creating a learning platform schema](https://hygraph.com/blog/building-learning-platform-schema “https://hygraph.com/blog/building-learning-platform-schema\”)\n\n## Requirements\n\n\n\nThis project uses Next.js 13 and the new App router. This will give us the most flexibility to extend the project in future installments using React Server Components to handle authentication and interactivity. A basic understanding of React and Next.js will help you through this article. If you didn’t follow through the content model article, you can clone [the Hygraph project here](https://app.hygraph.com/clone/fb3992dcf3bd4d909a942a48c2786705?name=Learning%20Platform “https://app.hygraph.com/clone/fb3992dcf3bd4d909a942a48c2786705?name=Learning%20Platform\”) to get started with this article.\n\n## Project setup\n\nTo start, we need to initialize a new Next.js 13 project. Open up your terminal and navigate to where you want your project, then run the following command:\n\n npx create-next-app learning-platform\n\nThe interactive setup will ask you questions to configure your project. Initialize with the following answers:\n\n- Typescript: No\n- ESLint: Yes\n- Tailwind CSS: Yes\n- src/
directory: No\n- App Router: Yes\n- Import alias: No\n\nOnce the options are chosen, the CLI will install all the necessary pieces to run your Next.js site.\n\n\n\n\n\nWe’re not entirely done with our setup yet, however. We need to adjust the default Tailwind styling that Next.js gives us from the installation.\n\nUpdate the global CSS rules in app/globals.css
to remove the extra styling and leave the file with the following Tailwind imports:\n\n @tailwind base;\n @tailwind components;\n @tailwind utilities;\n\nThat’s all the initial setup we need for the Next.js project, but let’s set up our Hygraph project as well. We’ll start with the learning platform schema created in the [first article in this series](https://hygraph.com/blog/building-learning-platform-schema “https://hygraph.com/blog/building-learning-platform-schema\”). To make it accessible to our Next.js project,mustd to open permissions on the [Content API](https://hygraph.com/docs/api-reference#content-api “https://hygraph.com/docs/api-reference#content-api\”).\n\nTo do this, navigate to your project’s settings and click on API Access. To start, let’s set the public content API to its default. This will give us access to all the content in our models to read into our project. From this same screen, grab the Content API endpoint URL.\n\nCreate a new file in the root of your project named .env.local
and add the variable HYGRAPH_ENDPOINT
. This will be where we add the endpoint we copied from Hygraph.\n\n HYGRAPH_ENDPOINT=YOUR-URL-HERE\n\nFrom here, we can run the site and implement the frontend.\n\n npm run dev\n\n## Setting up the homepage with a list of courses\n\nAfter the first article in this series, you should have a little content added to your Hygraph project. We’ll use that content to populate the homepage with a list of courses.\n\nIn Next.js 13’s App router structure, the homepage file is page.jsx
directly in the app
directory. The default file comes with a lot of Next.js promotional material; let’s eliminate all that and add a structure for displaying the courses.\n\n\n\n[Read the full post here](https://hygraph.com/blog/creating-learning-platform-nextjs-13-app-router “https://hygraph.com/blog/creating-learning-platform-nextjs-13-app-router\”).\n\n### The standard Lorem Ipsum passage, used since the 1500s\n\n”Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.”\n\n### Section 1.10.32 of “de Finibus Bonorum et Malorum”, written by Cicero in 45 BC\n\n”Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?”\n\n\n\n
\n\n### 1914 translation by H. Rackham\n\n”But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?”\n\n## Section 1.10.33 of “de Finibus Bonorum et Malorum”, written by Cicero in 45 BC\n\n”At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.”\n\n\n\n
\n\n### 1914 translation by H. Rackham\n\n”On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.”\n\n\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eu dui viverra leo auctor venenatis ac eget urna. Integer vitae lorem sapien. Aliquam dapibus nulla quis ullamcorper fringilla. Fusce mattis eros in sapien malesuada sagittis. Donec placerat in justo eget dapibus. Curabitur tincidunt condimentum magna eu pellentesque. Integer feugiat mattis sem non lacinia. Phasellus a nisi facilisis ex pharetra lacinia vel non dolor.\n\nPhasellus consectetur, velit et accumsan sagittis, tellus nibh aliquam justo, ac molestie massa ex et ipsum. Ut sit amet neque quis orci cursus posuere. Curabitur viverra sapien quis diam eleifend lobortis. Pellentesque porttitor pharetra metus, eget tincidunt tellus sagittis congue. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas malesuada eu erat non mollis. Sed quis eros sem. Cras at enim diam.\n\nNunc vitae ante in nulla viverra vestibulum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum justo mauris, efficitur sit amet sodales sit amet, tincidunt a velit. Nunc maximus iaculis dolor, eu ultricies odio. Mauris sed vulputate tellus. Duis dictum sem eleifend pellentesque hendrerit. Nulla vel justo mauris. In hac habitasse platea dictumst. Vivamus arcu diam, accumsan eget pellentesque in, dapibus eget turpis. Quisque tempor, sem id aliquet viverra, massa sem ornare arcu, nec ornare turpis lorem ut enim. Praesent lorem nulla, tristique ac turpis eget, tempor aliquam enim. Ut euismod aliquam scelerisque. Nunc magna nisi, auctor sagittis facilisis a, rhoncus congue nunc. Sed nec cursus risus, eget sodales ipsum.\n\n\n\n
\n\nCurabitur fringilla est et nibh tristique, in lobortis mi porttitor. Ut tincidunt nulla sit amet orci semper, vel dignissim magna tempus. Etiam fermentum aliquam diam, et sollicitudin justo sagittis eget. Nunc scelerisque pulvinar tempus. Integer vel elementum magna. Nullam facilisis lacus vitae quam lacinia tincidunt nec tristique ex. In cursus sagittis blandit.\n\nCurabitur nunc tortor, aliquam et tortor sit amet, feugiat luctus turpis. Proin malesuada vitae nibh blandit pulvinar. In eget libero eget diam rhoncus facilisis vitae ut velit. Suspendisse condimentum, dui in pharetra dignissim, elit orci tincidunt justo, id commodo enim libero vel enim. Duis blandit id magna ut sollicitudin. Vestibulum eleifend massa in tristique interdum. Vestibulum finibus eleifend pharetra. Praesent tempor tristique turpis nec laoreet. Cras sollicitudin feugiat diam ac convallis. Vestibulum finibus tortor nec metus imperdiet, vulputate accumsan dolor rhoncus. Pellentesque vitae pulvinar urna.\n\n\n\n
\n\nMaecenas egestas mauris id urna finibus, sed ornare neque pharetra. Nullam gravida iaculis cursus. Proin et dui risus. Suspendisse congue suscipit tristique. Integer luctus sapien ut lacus porta, et maximus sem euismod. Ut congue cursus est ac commodo. Nulla ultrices eu est vitae tempus. Curabitur volutpat maximus libero sit amet facilisis. Proin ligula magna, viverra eu mi vitae, tincidunt consectetur nunc. Sed mattis tellus et imperdiet tincidunt. Quisque vehicula interdum elit, quis auctor mi venenatis sit amet. Morbi maximus tristique urna eget tristique.\n\nMauris quis convallis leo. Quisque sit amet auctor justo, vel molestie eros. Curabitur quis sem ut turpis ultricies consequat in vel nunc. Vestibulum porttitor dolor a erat eleifend, in tempor mi rhoncus. Aenean molestie, tellus quis sagittis cursus, mi lacus malesuada arcu, non maximus ipsum quam eu dui. Vivamus magna orci, finibus sit amet euismod sit amet, consequat sit amet justo. Proin interdum non ligula elementum mattis.\n\nAliquam nibh arcu, rhoncus nec facilisis sed, convallis non arcu. Nulla eget accumsan ante. Mauris ut sapien odio. Vivamus sem neque, faucibus ac tellus sed, viverra iaculis lectus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent eu hendrerit magna. Sed placerat elit vitae urna pellentesque dapibus. In eget placerat lacus. Phasellus eu vulputate dui. Aliquam accumsan quam sit amet ligula fringilla, a facilisis erat bibendum. Mauris vitae pharetra leo. Praesent felis dolor, eleifend sed ex non, sollicitudin malesuada lorem. Pellentesque vel lacus quis quam cursus cursus et non lacus.\n\n\n\n## test heading\n\nIn scelerisque varius bibendum. Etiam imperdiet odio nulla, a bibendum elit convallis id. Fusce vel commodo risus, non sollicitudin est. Nam varius vehicula ipsum eu commodo. Proin eu iaculis felis, nec ornare risus. Praesent porta aliquam interdum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi rutrum consectetur faucibus. Nam aliquam feugiat sem, vitae congue erat.\n\nVivamus eu porttitor erat. Proin et massa eget libero bibendum euismod sit amet a mauris. Sed efficitur nisl ut aliquam sagittis. Curabitur ut aliquet diam. Fusce tempor ut erat non gravida. Mauris dolor augue, dignissim eu posuere ac, ultrices id felis. Pellentesque massa sem, gravida vitae lorem quis, vehicula commodo tellus. Cras tristique, lectus vitae sodales condimentum, metus nulla viverra lacus, at placerat sapien nisi vitae erat. Etiam porttitor quam mi, sit amet elementum nibh placerat in. Integer a turpis quam. Phasellus ullamcorper gravida dolor et elementum. Nullam nec lacus vitae neque tristique tempus.\n\n\n\n
\n\n## Another heading\n\nInteger hendrerit justo nec ligula posuere malesuada. Vivamus eget gravida sapien. Donec et ipsum risus. Pellentesque a feugiat eros. Praesent convallis dolor non semper lobortis. Curabitur sagittis condimentum pretium. Nunc finibus lobortis orci, nec molestie augue. Phasellus dictum augue laoreet luctus iaculis. Etiam congue nulla sed enim faucibus accumsan. Fusce fermentum tempor risus, vitae fringilla neque rutrum id. Ut semper faucibus quam, non molestie enim.\n\nQuisque posuere lorem eu ex imperdiet sollicitudin. Donec eleifend ligula ac sollicitudin tincidunt. Pellentesque est leo, vulputate eget ultricies efficitur, sollicitudin vel dui. Nullam ante sapien, mattis ac suscipit at, mollis et nibh. Aenean ornare sit amet erat eu tincidunt. Nulla facilisi. Donec eu ligula vitae orci elementum fringilla vitae a dolor. Mauris elit metus, fringilla sed molestie non, placerat quis eros.\n”