Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <header></header>

<div class="post-feed">
            <article class="post post-date-2">
              <div class="post-label" id="2020-02">February 2020</div>
              <a class="post-link" href="/example-year-archive/">
                <h2 class="post-title">Example year archive</h2>
              </a>
            </article>
             <article class="post post-date-2">
              <div class="post-label" id="2020-02">February 2020</div>
              <a class="post-link" href="/example-year-archive/">
                <h2 class="post-title">Example year archive</h2>
              </a>
            </article>
            <article class="post post-date-2">
              <div class="post-label" id="2020-02">February 2020</div>
              <a class="post-link" href="/example-year-archive/">
                <h2 class="post-title">Example year archive</h2>
              </a>
            </article>
			<article class="post post-date-1">
              <div class="post-label" id="2020-01">January 2020</div>
              <a class="post-link" href="/welcome/">
                <h2 class="post-title">Welcome to Ghost</h2>
              </a>
            </article>
            <article class="post post-date-1">
              <div class="post-label" id="2020-01">January 2020</div>
              <a class="post-link" href="/the-editor/">
                <h2 class="post-title">Writing posts with Ghost ✍️</h2>
              </a>
            </article>
            <article class="post post-date-1">
              <div class="post-label" id="2020-01">January 2020</div>
              <a class="post-link" href="/publishing-options/">
                <h2 class="post-title">Publishing options</h2>
              </a>
            </article>
            <article class="post post-date-1">
              <div class="post-label" id="2020-01">January 2020</div>
              <a class="post-link" href="/admin-settings/">
                <h2 class="post-title">Managing admin settings</h2>
              </a>
            </article>
            <article class="post post-date-1">
              <div class="post-label" id="2020-01">January 2020</div>
              <a class="post-link" href="/organising-content/">
                <h2 class="post-title">Organising your content</h2>
              </a>
            </article>
            <article class="post post-date-1">
              <div class="post-label" id="2020-01">January 2020</div>
              <a class="post-link" href="/apps-integrations/">
                <h2 class="post-title">Apps &amp; integrations</h2>
              </a>
            </article>
            <article class="post post-date-1">
              <div class="post-label" id="2020-01">January 2020</div>
              <a class="post-link" href="/themes/">
                <h2 class="post-title">Creating a custom theme</h2>
              </a>
            </article>
        </div>
              
            
!

CSS

              
                .post {
	margin-bottom: 80px;
}

.post-date-1 + .post-date-1 .post-label,
.post-date-2 + .post-date-2 .post-label,
.post-date-3 + .post-date-3 .post-label,
.post-date-4 + .post-date-4 .post-label,
.post-date-5 + .post-date-5 .post-label,
.post-date-6 + .post-date-6 .post-label,
.post-date-7 + .post-date-7 .post-label,
.post-date-8 + .post-date-8 .post-label,
.post-date-9 + .post-date-9 .post-label,
.post-date-10 + .post-date-10 .post-label,
.post-date-11 + .post-date-11 .post-label,
.post-date-12 + .post-date-12 .post-label {
  display: none;
}

header {
	text-align: right;
}
              
            
!

JS

              
                // Get all the date heading dates
let dates = [...document.querySelectorAll(".post-label[id]")].map(date => date.id);

// Remove duplicates
dates = Array.from(new Set(dates));

// Render list of links that go to the date section
document.querySelector('header').innerHTML = dates.map(date => `<a href="#${date}">${date}</a>`).join(" ");
              
            
!
999px

Console