Sign in

Is author not working?

  • This topic has 7 replies, 2 voices, and was last updated 1 month, 1 week ago by .
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5379
    publii-slpa

    I get this error…

    Rendering process failed
    An error (1002) occurred during parsing index.hbs file.

    author doesn’t match is – 130:9

    … it seems this code…

    {{#is "author"}}

    … is the cause.

    I am combining my various head partials created out of expedience into one. The only thing that really changes is the content of a div tag.

    I assume that “is author” should sense if the page is an author page.

    It passes “is index” which is first/before author during rendering.

    https://getpublii.com/dev/is-helper/

    I even literally cut and pasted the word author from this page. No go.

    Is my thinking right on this?

    Cheers!!

    #5380
    Bob

    Have you closed the tag {{/is}}?

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #5381
    publii-slpa

    Good day!

    Yes. I just double-checked that each “is” is properly closed.

    Cheers!!

    #5382
    Bob

    so you must provide a larger piece of code.

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #5383
    publii-slpa

    I am reviewing the html code. I may have messed it up somehow. I will let you know soon.

    #5385
    publii-slpa

    Ok. Because the exact error message is important and because it has changed slightly, I will post it again.

    Rendering process failed
    An error (1002) occurred during parsing index.hbs file.

    author doesn’t match is – 131:31

    Here is the head.hbs

    <!DOCTYPE html>
    <html lang="{{ @website.language }}">
    
    <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      <meta name="generator" content="RSD 5.0.3446">
        {{#if title}}
        <title>{{title}}</title>
        {{else}}
        <title>{{@website.name}}</title>
        {{/if}}
        {{metaDescription}}
      {{metaRobots}}
        {{{publiiHead}}}
      {{canonicalLink}}
      {{ampLink}}
      {{feedLink}}
        {{socialMetaTags}}
      {{#if @config.custom.faviconUpload}}
          <link rel="shortcut icon" href="{{@config.custom.faviconUpload}}" type="{{@config.custom.faviconExtension}}" />
        {{/if}}
        {{#if @pagination}}
      {{#if @pagination.previousPage}}
          <link rel="prev" href="{{@pagination.previousPageUrl }}">
      {{/if}}
      {{#if @pagination.nextPage}}
          <link rel="next" href="{{@pagination.nextPageUrl }}">
      {{/if}}
        {{/if}}
        {{> fonts}}  
        <link rel="stylesheet" href="{{css "style.css" }}">	
      {{#is "post"}}
            {{#post}}
                  {{#if hasGallery}}
                     <link rel="stylesheet" href="{{css "photoswipe.css" }}">
                  {{/if}}
            {{/post}}
      {{/is}}	
      {{#checkIf @config.custom.frontSource '==' "post" }}
            {{#checkIf @config.custom.frontGallery '==' true}}
                  {{#is "index"}}
                     <link rel="stylesheet" href="{{css "photoswipe.css" }}">
                  {{/is}}
            {{/checkIf}}
      {{/checkIf}}
      {{jsonLD}}	
      {{#is "post"}}
            {{#post}}
                  {{#if hasGallery}}
                    <style>				
                       {{#checkIf @config.custom.galleryLightboxStyle '==' "pswp--dark" }}
                      .pswp--svg .pswp__button,
                      .pswp--svg .pswp__button--arrow--left:before,
                      .pswp--svg .pswp__button--arrow--right:before {
                        background-image: url({{@website.assetsUrl}}/svg/gallery-icons-light.svg);
                        }
                      {{else}}
                        .pswp--svg .pswp__button,
                      .pswp--svg .pswp__button--arrow--left:before,
                      .pswp--svg .pswp__button--arrow--right:before {
                        background-image: url({{@website.assetsUrl}}/svg/gallery-icons-dark.svg);
                        }		
                      {{/checkIf}}
                    </style>		        
                  {{/if}}
            {{/post}}
            {{/is}}
            
            {{#checkIf @config.custom.frontSource '==' "post"}}
              {{#checkIf @config.custom.frontGallery '==' true}}
                {{#is "index"}}
                   <style>	
                    {{#checkIf @config.custom.galleryLightboxStyle '==' "pswp--dark" }}
                         .pswp--svg .pswp__button,
                         .pswp--svg .pswp__button--arrow--left:before,
                         .pswp--svg .pswp__button--arrow--right:before {
                          background-image: url({{@website.assetsUrl}}/svg/gallery-icons-light.svg);
                         }
                    {{else}}
                         .pswp--svg .pswp__button,
                         .pswp--svg .pswp__button--arrow--left:before,
                         .pswp--svg .pswp__button--arrow--right:before {
                          background-image: url({{@website.assetsUrl}}/svg/gallery-icons-dark.svg);
                         }		
                    {{/checkIf}}
                   </style>	
                {{/is}}	
              {{/checkIf}}
            {{/checkIf}}
      <link rel="stylesheet" href="{{css "bootstrap4.min.css"}}">
      <link rel="stylesheet" href="{{css "wireframe-theme.min.css"}}">
      <script>document.createElement( "picture" );</script>
      <script class="picturefill" async="async" src="{{js "picturefill.min.js"}}"></script>
      <link rel="stylesheet" href="{{css "main.css"}}">
      <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,500,b">
      <script type="application/ld+json">{"@context":"http://schema.org/","@type":"ApartmentComplex","address":{"@type":"PostalAddress","addressCountry":"US","addressLocality":"Everett","addressRegion":"PA","description":"219 West Main Street believes that a quality life should be affordable, convenient, comfortable, and hassle-free. That is our goal with neat and clean apartments within a reasonable price range.","hoursAvailable":{"@type":"OpeningHoursSpecification","closes":["7","7","7","7","7","5"],"dayOfWeek":["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"opens":["10","10","10","10","10","12"]},"name":"219 West Main Street Apartments","postalCode":"15537","streetAddress":"219 West Main Street","telephone":"(814) 204-0456"},"geo":{"@type":"GeoCoordinates","latitude":40.009830000000001,"longitude":-78.376897}}</script>
    
      {{{@headCustomCode}}}
    </head>
    
    <body>
      
    {{#if menus.mainMenu}} {{> menu menus.mainMenu}} {{/if}} <!-- index --> {{#is "index"}} {{#if menus.mainMenu}} {{> menu menus.mainMenu}} {{/if}}
    <span class="glyph quotes-icon"><i class="coffeecup-icons-bubble-quote"></i></span> <p class="paragraph quote-text">Nice quiet place clean and very convenient close to most stores and everyday needs.</p> <h3 class="quote-author">Brian Williams</h3>
    <span class="glyph quotes-icon"><i class="coffeecup-icons-star-full"></i></span><span class="glyph quotes-icon"><i class="coffeecup-icons-star-full"></i></span><span class="glyph quotes-icon"><i class="coffeecup-icons-star-full"></i></span><span class="glyph quotes-icon"><i class="coffeecup-icons-star-full"></i></span><span class="glyph quotes-icon"><i class="coffeecup-icons-star-full"></i></span>
    {{/is}} <!-- author v.2 --> {{#is "author"}}
    {{#if menus.mainMenu}} {{> menu menus.mainMenu}} {{/if}}
    <h1 class="heading-4">{{#author}}</h1>
    {{#if avatar}} <picture> <img src="{{avatar}}" {{ lazyload "eager" }} class="u-author__avatar" alt="{{name}}"> </picture> {{else}} <picture> Placeholder Picture </picture> {{/if}}
    {{#if description}} <p class="paragraph"> {{description}} </p> {{/if}}
    {{/is}} <!-- post --> {{#is "post"}} {{#post}} {{#featuredImage}} {{#if url}} <style> .container-grid.hero-container { background-image: url({{url}}) } </style> {{/if}} {{/featuredImage}} {{/post}} {{#if menus.mainMenu}} {{> menu menus.mainMenu}} {{/if}}
    {{#checkIf template '==' "post"}} <h1 class="heading-4">{{title}} --this is a post.</h1> {{else}} <h1 class="heading-4">{{title}}</h1> {{/checkIf}}
    {{/is}} <!-- tag --> {{#is "tag"}} {{#if menus.mainMenu}} {{> menu menus.mainMenu}} {{/if}}
    {{#tag}} <h1 class="heading-4">{{name}}</h1> {{/tag}}
    {{/is}}

    Here is the author.hbs

    {{> head}}
      
    <hr>
    <h6 class="section-header" data-outofview="true">articles</h6>
    <hr>
    {{#each posts}} {{#checkIf (isEven @index this) '==' true}}
    <h3 class="article-heading">{{title}}</h3> <p class="paragraph body-copy">{{{text}}}</p>
    <picture> Placeholder Picture </picture>
    {{else}}
    <picture> Placeholder Picture </picture>
    <h3 class="article-heading">{{title}}</h3> <p class="paragraph body-copy">{{{text}}}</p>
    {{/checkIf}} {{#if @last}} {{else}}
    <hr>
    {{/if}} {{/each}} {{>footer}}

    When I last left you, I had edited the wrong file making a mistake and had to reconcile all copies of head.hbs. I doubled-checked the code as much as I can — over and over against the original CoffeeCup Site Designer author.html file. All seems right code wise.

    As for the delay, we had some excitement here where my best friends daughter, a tenant, who has thought she had covid for a few days now, was taken away in an ambulance with EMTs in hazmat suits. That was 3 hours ago. Since then, my phone has not stopped ringing.

    Sorry it took so long to get back to you. Now I need to cook dinner.

    Cheers!!

    #5391
    Bob

    I found it, line 131, use {{name}} instead {{#author}} (https://getpublii.com/dev/author-tags/#author-tags) . The {{is}} helper just checks the page you’re on, so you also need to set the right context for your snippet.

    I assume you want to display the author’s name as well as the avatar and description. There are two ways to set the author context:

    {{#is "author"}}
        <div class="container-grid hero-container">
            {{#if menus.mainMenu}}
                {{> menu menus.mainMenu}}
            {{/if}}
            <div class="container-grid quote-column">
                <h1 class="heading-4">{{author.name}}</h1>
            </div>
            <div class="container-grid container-8">
                <div class="responsive-picture">
                    {{#if author.avatar}}
                        <picture>
                            <img
                                src="{{author.avatar}}"
                                {{ lazyload "eager" }}
                                class="u-author__avatar"
                                alt="{{author.name}}">
                        </picture>
                    {{else}}
                        <picture>
                            <img
                                loading="lazy"
                                alt="Placeholder Picture"
                                width="400"
                                height="300"
                                src="img/picture.svg">
                        </picture>
                    {{/if}}
                </div>
                {{#if author.description}}
                    <p class="paragraph">
                        {{author.description}}
                    </p>
                {{/if}}
            </div>
        </div>
    {{/is}}
    

    or more transparent:

    {{#is "author"}}
        {{#author}}
            <div class="container-grid hero-container">
                {{#if menus.mainMenu}}
                    {{> menu menus.mainMenu}}
                {{/if}}
                <div class="container-grid quote-column">
                    <h1 class="heading-4">{{name}}</h1>
                </div>
                <div class="container-grid container-8">
                    <div class="responsive-picture">
                        {{#if avatar}}
                            <picture>
                                <img
                                    src="{{avatar}}"
                                    {{ lazyload "eager" }}
                                    class="u-author__avatar"
                                    alt="{{name}}">
                            </picture>
                        {{else}}
                            <picture>
                                <img
                                    loading="lazy"
                                    alt="Placeholder Picture"
                                    width="400"
                                    height="300"
                                    src="img/picture.svg">
                            </picture>
                        {{/if}}
                    </div>
                    {{#if description}}
                        <p class="paragraph">
                            {{description}}
                        </p>
                    {{/if}}
                </div>
            </div>
        {{/author}}
    {{/is}}
    

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #5392
    publii-slpa

    I looks I made a wrong assumption somewhere.

    Fortunately, it was a simple one.

    The error had me looking in the wrong areas.

    Cheers Mate!!

    I do appreciate it.

    BTW- The more practice I get, the more I will be able to do.

    Hopefully, I will good enough at all this to come up with a few templates to offer.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.