Example #1
0
    def get_context_data(self, *args, **kwargs):
        properties = self.page.get('properties', {})
        breadcrumb = []
        for page_name in properties.get('breadcrumb', []):
            page = get_page_by_attr('url_name', page_name)
            title = (page['properties']['title']
                     if 'properties' in page and 'title' in page['properties']
                     else "")
            breadcrumb.append({
                'link': reverse_page(page_name),
                'name': title
            })

        context = {
            "properties": properties,
            "breadcrumb": breadcrumb
        }

        if 'markdown_file' in self.page:
            context['content'] = load_md_file(self.page['markdown_file'])
            context['markdown_file'] = self.page['markdown_file']

        if 'redirect_path' in self.page:
            context['redirect_path'] = '/%s/' % self.page['redirect_path']

        return context
Example #2
0
 def get_paths(self):
     from .urls import urlpatterns
     paths = ['/']
     for pattern in urlpatterns:
         if pattern.name not in self.EXCLUDED_PATTERNS:
             url = reverse_page(pattern.name)
             url += "/" if not url.endswith("/") else ""
             paths.append(url)
     return frozenset(paths)
Example #3
0
 def get_paths(self):
     api_md_pages_paths = [reverse_page(page['url_name']) for page in PAGES]
     return frozenset(api_md_pages_paths)