Giter VIP home page Giter VIP logo

Comments (18)

RomainMazB avatar RomainMazB commented on June 1, 2024 2

@Keats additionally to the sitemap, the hidden property feature would handle the fact that the internal search doesn't index these pages.

ATM for the bevyengine/bevy docs, we do not use the internal search feature so we can go with the solution you mentioned using extra and modifying the sitemap.xml template (cc @tuyen-at-work):

[extra]
status = 'hidden'
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    {% for sitemap_entry in entries %}
    {% if not sitemap_entry.extra.status %}
    <url>
        <loc>{{ sitemap_entry.permalink | escape_xml | safe }}</loc>
        {% if sitemap_entry.updated %}
        <lastmod>{{ sitemap_entry.updated }}</lastmod>
        {% endif %}
    </url>
    {% endif %}
    {% endfor %}
</urlset>

But if we integrate the search engine, we will need this feature.
With the search engine problematic in mind, would you accept a PR to tackle this?

from zola.

tuyen-at-work avatar tuyen-at-work commented on June 1, 2024 2

Hi @Keats @glhewett @pietroalbini,

My initial request did not cover the functionality to override the hidden property for nested pages (meaning if a section is hidden, all child pages are also hidden). However, including this feature would be a valuable addition.

If you are currently working on supporting the override of properties on child pages, please also consider implementing it for child sections.

from zola.

mwcz avatar mwcz commented on June 1, 2024

draft already covers most of these needs, but I'm not sure if it can be used on sections.

from zola.

tuyen-at-work avatar tuyen-at-work commented on June 1, 2024

@mwcz draft is use for different purpose. For example on local you create a markdown file but decide that it is not ready for delivery then you mark it as draft.

If you deliver the site with zola build --drafts then the draft pages will be rendered, but they also appear in sitemap/feed/atom/search index. Therefore it does not serve the same purpose.

from zola.

Keats avatar Keats commented on June 1, 2024

I'm not sure we want that, that's pretty niche. You can accomplish the same by writing your own sitemap template and checking for a specific arg in extra to not include them and when rendering section (breaks down though if you have hidden things in a paginated section).

from zola.

mwcz avatar mwcz commented on June 1, 2024

If you deliver the site with zola build --drafts then the draft pages will be rendered, but they also appear in sitemap/feed/atom/search index. Therefore it does not serve the same purpose.

zola build --drafts
zola build

Then deploy. I used to do that with Hugo and it works just as well with Zola. The only thing it doesn't cover is hidden sections.

from zola.

glhewett avatar glhewett commented on June 1, 2024

I came across this feature request, and this is exactly what I was hoping for. I am 48 hours into using zola, and I am really enjoying it. I have some experience with some other static site generators, so I am not a completely new to this.

I really like the idea of the hidden flag. I think I have seen it in other generators that I have used. I was expecting the in_search_index to behave like what is being propose here. I was sad to see that it was not that.

My use case is simple. I like to do my documentation in markdown -- as most of us that would be using this tool. I would like to create documentation, host it on my site, and choose who can have a link to it. It is kinda like a gist that is hosted on my domain.

@Keats -- I saw that you think this is rather niche, and I agree that many might not be using it. However, I want to provide my attempt to warm you up to accepting a PR if I provide one.

The following is an example of how I might want to use this. Notice that I am obfuscating the URL to make it harder to guess.

+++
title = "First Private Page"
slug = "m3SrhoqK"
date = 2024-02-04
hidden = true
+++

# Private Page

This is my first private page.

from zola.

Keats avatar Keats commented on June 1, 2024

Looks like it's not that niche!

How does it work for sections? Hidden sections implies all hidden pages with no way to un hide them?

from zola.

tuyen-at-work avatar tuyen-at-work commented on June 1, 2024

Hey @Keats,

I'd like to highlight that there's currently support for route-based protection in some static hostings. For instance, Azure Static Web Apps offers the ability to secure routes with roles. I believe platforms like Netlify and Vercel may also have similar features.

It would be great if content within protected routes doesn't get exposed in public links, such as sitemaps, search indexes, or atom feeds.

This functionality also allows us to seamlessly include both public and private content on the same website without worrying about unauthorized access.

from zola.

Keats avatar Keats commented on June 1, 2024

Well you would have to use that new hidden field and map that with your host if needed

from zola.

tuyen-at-work avatar tuyen-at-work commented on June 1, 2024

Yes I understand Zola shouldn't worry about config the cloud hosting, just want to highligh that some clouds support route-based protection. I think the use-case is popular enough that Microsoft decided to supports it for a long time already.

This feature, if being implemented, will enable us to utilize that feature nicely, i.e. if I decide to protect a route in the host, all I need to do from zola side is set the route to hidden and it will be out of the world's knowledge.

from zola.

darrenmeehan avatar darrenmeehan commented on June 1, 2024

There's some content I'd use for this capability for if it existed!

I think if this feature is added it should be documented clearly that these pages are still publicly accessible.

At risk of feature creep, would it be useful to output a count of hidden pages?

from zola.

pietroalbini avatar pietroalbini commented on June 1, 2024

Looks like it's not that niche!

Is this something you'd accept a pull request for?

How does it work for sections? Hidden sections implies all hidden pages with no way to un hide them?

That could work, otherwise we could have three states for hidden: missing/true/false, where missing inherits from the parent section.

from zola.

Keats avatar Keats commented on June 1, 2024

Is this something you'd accept a pull request for?

Yes, as long as there's a clear solution for section with hidden=true.

That could work, otherwise we could have three states for hidden: missing/true/false, where missing inherits from the parent section.

So something like

  • if section hidden=true
  • then a page/section inside can have hidden=false to be displayed?

from zola.

glhewett avatar glhewett commented on June 1, 2024

I am working through creating a PR. I am not going very fast, so if someone beats me to it, I think that is great. Two thoughts that I had while I am working on this:

  1. I was thinking that an implementation in sections might be confusing. For a blog with a hidden post, I would just set the page to hidden and allow the section to be displayed. The section should obey the pages' hidden=true flag and not render the link. For a section that contains only private content, I would like to just set the render=false meta in the section. This means that every hidden page would need to be explicitly set. Does this sound reasonable?
  2. I was thinking that the filter logic that is implemented into the templates may cause a user error or a regression. I am looking to make sure that the page filter for hidden=true is implemented in the code that calls the template.

@pietroalbini, I am happy to share what I have if you want to make this go faster.

I have done sitemaps and feeds. I now need add the filter to the section, search and write some tests.

from zola.

Keats avatar Keats commented on June 1, 2024

For 1 I would expect to be able to set hidden=true in the section but have pages or subsections in them with hidden=false and let them render? Not sure how that works in practice though.

from zola.

clarfonthey avatar clarfonthey commented on June 1, 2024

I think that defaulting the hidden = true status of a section but still allowing you to override it works. Seems pretty consistent to me.

from zola.

izissise avatar izissise commented on June 1, 2024

So I struggled with this today #742 (comment)

But I found a workaround with dates:

    {% set ts_now = now()|date(format="%s")|int %}
    {%- for page in pages %}
    {% set ts_page = page.date|default(value=0)|date(format="%s")|int %}
    {% if ts_page < ts_now %}
    html...
    {% endif %}
   {%- endfor %}

The logic can be apply on sitemap atom etc...
This way you can just set date = "3024-02-23" on a post that you don't want published.

from zola.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.