Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error calling index: index of untyped nil #35

Open
appernetic opened this issue Aug 14, 2017 · 2 comments
Open

error calling index: index of untyped nil #35

appernetic opened this issue Aug 14, 2017 · 2 comments
Labels

Comments

@appernetic
Copy link

Hi, I get this error when I use the files from the example folder:
hugo server -D
Started building sites ...
ERROR 2017/08/14 03:01:42 Error while rendering "page": template: theme/_default/single.html:1:3: executing "theme/_default/single.html" at <partial "structure/h...>: error calling partial: template: theme/partials/structure/head.html:12:7: executing "theme/partials/structure/head.html" at <partial "amp/header"...>: error calling partial: template: theme/partials/amp/header.html:4:16: executing "theme/partials/amp/header.html" at <index (index $.Site....>: error calling index: index of untyped nil

I am using Hugo version v0.20.7 darwin/amd64 BuildDate: 2017-05-17T00:59:06+02:00

@wildhaber wildhaber added the bug label Aug 16, 2017
@wildhaber
Copy link
Owner

@appernetic thanks for the message. I'll try to reproduce and looking for a fix.

@wildhaber
Copy link
Owner

Unfortunately I cannot reproduce this error on v0.26.

But we might could help you if you could debug the variables you get in the following file:

File: themes/gohugo-amp/layouts/partials/amp/header.html:L4

Replace line 3-9:

    {{- range $.Site.Params.ampElements -}}
        {{ $.Site.Params | jsonify }}
        {{ $.Site.Data | jsonify }}
        {{- if (index (index $.Site.Data "amp-modules") .) -}}
            <script async custom-element="{{ . }}" src="{{ (index (index $.Site.Data "amp-modules") .) }}"></script>
        {{- end }}
    {{- end }}

With:

    {{- range $.Site.Params.ampElements -}}
        Context: {{ . | jsonify }}
        Site Params: {{ $.Site.Params | jsonify }}
        Amp-Modules: {{ ($.Site.Data "amp-modules") | jsonify }}
        {{- if (index (index $.Site.Data "amp-modules") .) -}}
            <script async custom-element="{{ . }}" src="{{ (index (index $.Site.Data "amp-modules") .) }}"></script>
        {{- end }}
    {{- end }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant