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

Cannot use this theme for Hugo deployed on Vercel #71

Closed
Mosaic67 opened this issue Nov 7, 2020 · 6 comments
Closed

Cannot use this theme for Hugo deployed on Vercel #71

Mosaic67 opened this issue Nov 7, 2020 · 6 comments

Comments

@Mosaic67
Copy link

Mosaic67 commented Nov 7, 2020

Thank you very much for designing and developing this theme, I like it very much, but there is a problem when deploying Hugo on Vercel and applying this theme.

Error step:

  1. Create a Vercel account and select the Hugo template.
  2. Connect to Github, Vercel will create a repo.
  3. Vercel initializes a Hugo address, which is normal and accessible
  4. Use Papermod - Installation to install

git submodule add https://github.com/adityatelange/hugo-PaperMod.git themes/hugo-PaperMod
git submodule update --init --recursive
git submodule update --remote --merge
theme = "ananke" >> theme = "hugo-PaperMod"

  1. Terminal.exe hugo server -D, It work on loaclhost.
  2. commit and pull to Github, Vercel will deploy hugo
  3. An error occurred during deployment

This is Vercel Build Logs:

14:37:13.594  	Cloning github.com/Mosaic67/Hugo (Branch: master, Commit: dfe9c79)
14:37:14.533  	Cloning completed in 938ms
14:37:14.535  	Analyzing source code...
14:37:16.307  	Installing build runtime...
14:37:16.804  	Build runtime installed: 497.035ms
14:37:17.816  	Installing dependencies...
14:37:18.106  	yarn install v1.22.4
14:37:18.124  	info No lockfile found.
14:37:18.130  	[1/4] Resolving packages...
14:37:18.131  	[2/4] Fetching packages...
14:37:18.132  	[3/4] Linking dependencies...
14:37:18.139  	[4/4] Building fresh packages...
14:37:18.143  	success Saved lockfile.
14:37:18.145  	Done in 0.05s.
14:37:18.180  	WARN 2020/11/07 06:37:18 Module "hugo-PaperMod" is not compatible with this Hugo version; run "hugo mod graph" for more information.
14:37:18.201  	Error: add site dependencies: load resources: loading templates: "/vercel/workpath0/themes/hugo-PaperMod/layouts/shortcodes/collapse.html:4:1": parse failed: template: shortcodes/collapse.html:4: function "warnf" not defined
14:37:18.205  	Error: Command "hugo -D --gc" exited with 255
14:37:21.369  	Done with "config.toml"

And Netlify,

Can start, but the reality is not normal, I don’t know why

image

This is my netlify.toml

[build]
publish = "public"
command = "hugo --gc --minify"

[context.production.environment]
HUGO_VERSION = "0.78.1"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"

[context.split1]
command = "hugo --gc --minify --enableGitInfo"

[context.split1.environment]
HUGO_VERSION = "0.78.1"
HUGO_ENV = "production"

[context.deploy-preview]
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"

[context.deploy-preview.environment]
HUGO_VERSION = "0.78.1"

[context.branch-deploy]
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"

[context.branch-deploy.environment]
HUGO_VERSION = "0.78.1"

[context.next.environment]
HUGO_ENABLEGITINFO = "true"
@adityatelange
Copy link
Owner

try to add specific Hugo version

https://vercel-com.cdn.ampproject.org/v/s/vercel.com/guides/deploying-hugo-with-vercel.amp?amp_js_v=0.1&usqp=mq331AQFKAGwASA%3D#optional:-define-a-hugo-version

use 0.75.0 (latest I guess)

@Mosaic67
Copy link
Author

Mosaic67 commented Nov 7, 2020

It's work!But netlify is still not normal

image

@adityatelange
Copy link
Owner

@Mosaic67 Disable CSS, JS minification for Netlify. Hugo does this for you already.
Reason: this theme uses fingerprint checksum by default, changing the file contents changes the hash and browser denies to load the resource.

@meyusufdemirci
Copy link

meyusufdemirci commented Nov 15, 2020

Hey @adityatelange ,
I see the bad look that Mosaic67 faced. How I can disable CSS? BTW, I am using AWS Amplify.

@adityatelange
Copy link
Owner

Hey @adityatelange ,
I see the bad look that Mosaic67 faced. How I can disable CSS? BTW, I am using AWS Amplify.
@demirciy
Disable css ? Nope.
Put valid baseURL
and disable minification for assets like css /js

you may read https://myhightech.org/posts/build-page-with-hugo/

@meyusufdemirci
Copy link

I got it. The problem was about the baseURL in the config. Once I get a URL which is similar to github.io.asderfsfsg.mywebsite.com or something like that, I have to set it to the baseURL. Of course, I must change it after getting the custom domain.

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

No branches or pull requests

3 participants