<aside class="sidebar sidebar--right">
    <div class="sidebar__inner sidebar__inner--right">
        {{#is "post"}}
            {{#post}}
                {{#primary_author}}
                    <section class="author-feature author-feature--top">
                        {{#if profile_image}}
                            <img class="avatar avatar--large" src="{{img_url profile_image size="s"}}" alt="{{name}}">
                        {{else}}
                            <div class="avatar avatar--large avatar--fallback">A</div>
                        {{/if}}
                        <div class="author-feature__body">
                            <h3>{{name}}</h3>
                            {{#if bio}}<p>{{bio}}</p>{{/if}}
                        </div>
                        <span class="author-feature__action">↗</span>
                    </section>
                {{/primary_author}}
            {{/post}}
        {{/is}}

        <section class="site-intro">
            {{#if @site.icon}}
                <img class="site-icon" src="{{@site.icon}}" alt="{{@site.title}}">
            {{else}}
                <div class="site-icon site-icon--fallback">T</div>
            {{/if}}
            <div class="about-block">
                <h2>{{@site.title}}</h2>
                {{#if @site.description}}
                    <p>{{@site.description}}</p>
                {{/if}}
            </div>
        </section>

        {{subscribe_form
            placeholder="Your email"
            button_class="button button--subscribe"
            form_class="subscribe-form"
        }}

        <section class="sidebar-card sidebar-card--tight">
            <div class="sidebar-card__header">
                <h2>Follow</h2>
                <span class="sidebar-card__action">↗</span>
            </div>
            <div class="social-row">
                {{#if @site.facebook}}<a href="{{social_url type="facebook"}}" aria-label="Facebook">f</a>{{/if}}
                {{#if @site.twitter}}<a href="{{social_url type="twitter"}}" aria-label="X">x</a>{{/if}}
                <a href="{{@site.url}}/rss/" aria-label="RSS">rss</a>
            </div>
        </section>

        <section class="sidebar-card sidebar-card--tight">
            <div class="sidebar-card__header">
                <h2>Recommended</h2>
                <span class="sidebar-card__action">↗</span>
            </div>
            <ul class="recommended-list">
                {{#get "posts" filter="featured:true" limit="3" include="tags"}}
                    {{#foreach posts}}
                        <li><a href="{{url}}">{{title}}</a></li>
                    {{/foreach}}
                {{else}}
                    <li><a href="{{@site.url}}">{{@site.title}}</a></li>
                {{/get}}
            </ul>
        </section>

        <section class="sidebar-card sidebar-card--about">
            <p>{{@site.title}} is a thoughtfully designed Ghost theme inspired by editorial communities, with flexible settings that let you shape it to your publication.</p>
            <a class="button button--accent" href="{{@site.url}}">About {{@site.title}}</a>
        </section>

        {{#is "post"}}
            {{#post}}
                <section class="sidebar-card sidebar-card--tight">
                    <div class="sidebar-card__header">
                        <h2>Read next</h2>
                    </div>
                    <ul class="recommended-list">
                        {{#get "posts" filter=(concat "id:-" id) limit="4"}}
                            {{#foreach posts}}
                                <li><a href="{{url}}">{{title}}</a></li>
                            {{/foreach}}
                        {{/get}}
                    </ul>
                </section>
            {{/post}}
        {{/is}}

        <footer class="copyright">©{{date format="YYYY"}} {{@site.title}}. Published with Ghost.</footer>
    </div>
</aside>
