eudicots / Cactus

Static site generator for designers. Uses Python and Django templates.
BSD 3-Clause "New" or "Revised" License
3.46k stars 314 forks source link

Django variable CURRENT_PAGE.absolute_final_url not existing in Cactus 1.1.22 (440) #264

Closed rob-weiss closed 7 years ago

rob-weiss commented 7 years ago

I prettified my URLs and tried to set my "Meta canonical" according to the README.md using

<link rel="canonical" href="{{ CURRENT_PAGE.absolute_final_url }}" />

This gives me:

<link rel="canonical" href="" />

Seems the Django variable is not existing.

ghost commented 7 years ago

Hi robin,

I can only confirm that this works with the v3.3.3 command line version of Cactus (this GitHub repo). You could either switch to the command line version or update the Cactus app package with the command line version (updating the cactus folder within the app package).

rob-weiss commented 7 years ago

Hi pani-c,

thank you for your answer!

I downloaded and unpacked the GitHub repo and replaced

/Applications/Cactus.app/Contents/Resources/python/CactusSource/cactus 

with the cactus folder. This gives me the following error:

Traceback (most recent call last): File "/Applications/Cactus.app/Contents/Resources/python/run.py", line 44, in <module> cli.main(sys.argv[1:]) File "/Applications/Cactus.app/Contents/Resources/python/CactusSource/cactus/cli.py", line 152, in main cli.do_imports() File "/Applications/Cactus.app/Contents/Resources/python/CactusSource/cactus/cli.py", line 25, in do_imports from cactus.site import Site File "/Applications/Cactus.app/Contents/Resources/python/CactusSource/cactus/site.py", line 29, in <module> from cactus.page import Page File "/Applications/Cactus.app/Contents/Resources/python/CactusSource/cactus/page.py", line 4, in <module> import yaml ImportError: No module named yaml
screen shot 2016-12-10 at 13 29 54

What am I doing wrong?

ghost commented 7 years ago

Hi robin,

looks like the app is missing some dependencies. I am using both cli and app. I think the only thing I did was just installing the cli version and updating the cactus folder of the app to get all dependencies.

I just tested this by downloading the app and overwriting the content of its cactus folder... works. If cli + app doesn't get you going, I'll have another look!

rob-weiss commented 7 years ago

Here's what solved my problem:

To make sure I am really using the latest version of Cactus I deleted the Cactus app and CLI and reinstalled the CLI using

sudo easy_install cactus

as described in the README. Then I downloaded Cactus for Mac version 1.1.22 here

https://www.macupdate.com/app/mac/50357/cactus

and replaced the cactus folder as described above.

That did not yet solve my problem but I wanted to make sure that I use the latest Cactus version and replace the right folder.

What was actually missing was the page_context.py plugin, which can be found in the plugins folder by default when creating a new project with the latest Cactus version. Since I created my existing project using the old version I was apparently only missing this plugin. May well be that copying this in my project folder would have been enough to solve the problem.

Anyway, now it's working. Thank you so much for your help pani-c! I appreciate that a lot :)

rob-weiss commented 7 years ago

Actually, I have one more question related to the above issue.

Google says here that to

Avoid errors: use absolute paths rather than relative paths with the rel="canonical" link element. Use this structure: https://www.example.com/dresses/green/greendresss.html Not this structure: /dresses/green/greendress.html).

Cactus gives me a URL relative to the root domain, that is for example

/

for the index page and

/blog/

for the blog page.

Is that the expected behaviour? I thought {{ CURRENT_PAGE.absolute_final_url }} will give me

www.example.com/blog/
ghost commented 7 years ago

Does adding site-url to your config as explained in the readme make any difference? Can't test myself until tomorrow...

rob-weiss commented 7 years ago

I thought I did that but it was in fact missing. Though my issues seem to be quite trivial I really appreciate your help. Thank you so much pani-c!

ghost commented 7 years ago

You're welcome!

Am 13.12.2016 um 02:41 schrieb Robin Weiss notifications@github.com:

I thought I did that but it was in fact missing. Though my issues seem to be quite trivial I really appreciate your help. Thank you so much pani-c!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.