Drupal 8 User Guide: 5.2. Creating a Content Item

Drupal 8 User Guide: 5.2. Creating a Content Item


Creating a Content Item
with Amber Matz In this tutorial we’ll walk through
how to create a content item using the Basic page content type. By the end of this tutorial
you will understand how to create and publish
a content item that will be used
as the home page of the site. To follow along you should have
Drupal 8 installed, and the Basic page
content type must exist. If you install Drupal
with the standard installation profile, the Basic page content type
will already be created for you. Finally, to get the most
out of this tutorial, you’ll need to understand
how paths, aliases, and URLs work on the web and in Drupal. See the written version of this tutorial for a link
to the prerequisite tutorials. In the Manage administrative menu,
navigate to Content. Then click Add content, and Basic page. The Create Basic page form appears. Click Edit summary
to reveal the summary field. First, let’s give our page
a title of Home. The Title field will be used
in the title tag in the HTML source code of the page
and in any other relevant meta tags. The words in the title are used
to construct the automatic URL alias and the title is also used as a label for the content item
in various administrative screens. The Summary field should be
a summary of the body field. Enter the following. Opening times
and location of City Market. The summary is commonly used
as teaser text, especially in lists of content,
RSS feeds and other views. The summary can be optional, and if it is blank,
a trimmed version of the body would be used in teasers instead. The Body field is the simplest
and most straightforward way to enter the primary content
of your page. Let’s enter the following. You can see the written version of
this tutorial for copy-pasteable text. Our Body field is using
the Basic HTML text format. This text format is configured
to use a WYSIWYG or What You See Is What You Get
editor called CKEditor. That’s what’s providing these handy
little formatting buttons here. If we click on Source, we can see the underlying HTML that will be used as the markup
for the contents of this field. Clicking Source again
will return us to the WYSIWYG editor. If I wanted to bold some text,
for example, I would highlight the text I wanted
to bold like Open, then click B. I could do the same
for the Location text. To experiment with paragraph
formats and headings, highlight the first line, “Welcome to City Market –
your neighborhood farmers market,” and select the Normal dropdown. Then select Heading 2
as a paragraph format. We can see in the source how the first line
was marked up with an h2 tag, and the Open and Location text was marked up
with the strong HTML tags. Explore the toolbar
and practice creating linked text, bulleted lists and numbered lists
as well. Next, go over to the URL Path
Settings. That’s over here in the right sidebar. And for URL alias, type in /home. We’ll configure this
as the path for our home page in the tutorial, Designating
a Front Page for Your Site. Now we’re ready to preview our changes. Click the Preview button. Ensure that everything
looks as you expect and then click Back to content editing
to finalize our publication. The Published checkmark is checked. If you wanted to save a draft,
uncheck this box. We’re ready to publish
so let’s click Save. In this tutorial we created a new content item using
the Basic page content type that will be used
as our site’s front page.

About the author

Leave a Reply

Your email address will not be published. Required fields are marked *