My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
FAQ  
Frequently Asked Questions
Updated Jul 6, 2009 by batiste....@gmail.com

FAQ

How can I specify a meta description for each page and for each language?

If you want to have a field for the description meta tag just add a placeholder in your template:

<meta name="keywords" content="{% placeholder meta_description with TextInput %}" />

And an translated field should appears in the admin.

How can I show content part of the page without using a placeholder?

The show_content template tags is here for that:

{% show_content the_page_object "the_content_type" %}

You can also specify the slug of the page instead of the page object itself:

{% show_content "my-page-slug" "the_content_type" %}

For a full documenation : display content in templates

Nothing show up at the frontend. What is the problem?

  • Check that you have set your site domain name correctly (ie: for local-host development you will need to set it to 127.0.0.1:8000)
  • Check that you have published the page correctly

The tree collapse and doesn't expand. What is the problem?

  • Check that you have set your site domain name correctly (ie: for local-host development you will need to set it to 127.0.0.1:8000, you use localhost:8000 you must have an entry called localhost:8000).
  • Check also that the SITE_ID you have in your settings file is the one you are using to access.

Add a language prefix before the urls

  1. change the url routing to accept a language prefix parameter (lang)
  2. the default view named "details" accept this parameter and display the page content accordingly.
Comment by andybak, Oct 26, 2008

"Imagine that the URL change because the user has moved the page in the tree or because the user has changed the slug."

mmmm. If the slug doesn't specify the page in the URI then why is it in the URL at all?

Unique Resource Identifier. CMS editors have to be educated to realise that a slug identifies the page. If they want to rename the slug then links to the page will break.

If the id is the only identifier of the page then URI's should be of the form http://www.example.com/34 or http://www.example.com/?id=34 as the rest of the URI is just cosmetic (I suppose the need for SEO-friendly URI's might be a counter argument but still...)

Comment by werner%b...@gtempaccount.com, Oct 27, 2008

Unique ID are good internally -- they can be used to give the URL of a page in using something like <a href="{doc_url id=123}"> -- or as a way to give permalinks (if you think you may change your URLs). However the best URLs remain those that do NOT change. I don't think adding the id in the end is a good solution. Users now even expect to change the URL to return to the parent cathegory.

Comment by kenneth....@gmail.com, Nov 1, 2008

>> Why have you done this horrible thing?

Er, so you know it's a horrible thing. Ok. The best way to manage this would be to maintain a history, and use 301 redirects from old urls to new ones. Other options include a clever 404 page which can use text searches to proffer possible options. Google's Webmaster Tools offer this option via JS.

Good URLs are standard for the Internet. Pages should be placed at sensible URLs - that's why they're there, and Search Engines will depend on them. Allow me my pleasant URLs, and let me handle the trivial problem of the 404s. :)

Comment by project member batiste....@gmail.com, Nov 6, 2008

"Users now even expect to change the URL to return to the parent cathegory"

Good point

"I suppose the need for SEO-friendly URI's might be a counter argument but still..."

Yes the actual solution is more about to be SEO friendly before anything.

"The best way to manage this would be to maintain a history, and use 301 redirects from old urls to new ones"

Yes its nice but its also very complicated. I will think about a slug solution. It's not that its difficult to implement. We already have a uniqueness of the slug as an option and implementing a view function that take the slug instead of the page id is very simple.

Comment by charles....@gmail.com, Jan 25, 2009

Wordpress, I believe, remembers old slugs and does the 301 thing.

Comment by k...@limist.com, Jan 27, 2009

Wordpress definitely remembers old slugs and automatically creates 301 redirects, the user can change the slug as many times as he wants without trouble. I think the changing of slugs is a common enough use-case that automatic 301 for prior slugs is worth doing.

Comment by akaih...@gmail.com, Feb 24, 2009

The "Add a language prefix before the urls" tip seems to be incorrect. The example view in pages/views.py does not use the "lang" variable at all. Adding a "django.utils.translation.activate(lang)" statement doesn't change the language of displayed pages, since the {% placeholder %} tag retrieves the language from the request.

Either a redirect or changing the language logic of {% placeholder %} is needed.

Comment by dillon.f...@gmail.com, Mar 20, 2009

The Part above about I have an error trying to display a page in the admin needs changed as the middleware is no longer used.

Comment by geoffdeg...@gmail.com, Jun 15, 2009

How could I suppress the meta tag, if there is no content or its an empty string?

Comment by wgb237@gmail.com, Jul 27, 2009
Comment by javi.azu...@gmail.com, Jun 18, 2010

Maybe this will save someone a few hours hitting his head with the monitor:

Why aren't my static files being served? Why are my static files returning 404 status? What's this "GET pages/javascript/jquery.js HTTP/1.1" 404 on my log?

If you are on a development enviroment serving your static media in urls.py with something like

if settings.DEBUG:
        urlpatterns = patterns('',
                url(r'^static/(?P<path>.*)$', 'django.views.static.serve',
                        { 'document_root' : settings.MEDIA_ROOT }),
        )

ensure you have that entry before the

    # serve pages
    (r'^', include('pages.urls')),

one, or else it won't work.

Comment by sa...@kxwheels.com, Jun 18, 2014

How can I PM you ^^ javi.azu...@gmail


Sign in to add a comment
Powered by Google Project Hosting