1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
//! IndexNow for Laravel Rust: tell search engines a URL changed, the moment it changes.
//!
//! IndexNow is a small protocol: you publish a key file on your domain, then POST the URLs that
//! changed. Bing, Yandex, Seznam, Naver and Yep consume it, and one submission to the shared
//! endpoint reaches all of them. **Google does not participate**, so this complements your
//! sitemap, it does not replace it.
//!
//! This crate wires the protocol into your models, so publishing a post submits its URL and
//! unpublishing it submits the URL again, which is the part most implementations miss.
//!
//! ```ignore
//! IndexNowServiceProvider::new().track(
//! indexnow::track::<Post>()
//! .url_template("https://example.com/blog/{slug}")
//! .when_holds("status", "published"),
//! )
//! ```
//!
//! It is the port of the PHP package [`edulazaro/laraindexnow`](https://github.com/edulazaro/laraindexnow)
//! to Laravel Rust 0.1 (beta), and its API follows the framework's changes until 1.0.
use Arc;
use Inject;
use Model;
pub use ;
pub use ;
pub use KeyRepository;
pub use ;
pub use Policy;
pub use IndexNowServiceProvider;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Attr;
/// Start tracking a model. Chain the rules on the returned [`Registration`] and hand it to
/// [`IndexNowServiceProvider::track`].
/// The IndexNow service of the running application.
///
/// # Errors
///
/// Fails when the [`IndexNowServiceProvider`] is not registered.
pub async
/// Buffer URLs and let the queue send them. Sent inline when the queue is disabled.
///
/// # Errors
///
/// Fails when the cache or the queue does.
pub async
/// Send URLs inline and return what the endpoint said.
///
/// # Errors
///
/// Fails with a [`RetryableSubmission`] when the endpoint rate limits or errors.
pub async
/// Submit the URL of a tracked record, resolved from its registrations.
///
/// # Errors
///
/// Fails when a registration has no URL resolver, or when [`submit`] does.
pub async
/// Register a source for `indexnow:due` while the application runs.
///
/// # Errors
///
/// Fails when the [`IndexNowServiceProvider`] is not registered.
pub async
/// Register a sitemap, or a sitemap index, as a source while the application runs.
///
/// # Errors
///
/// Fails when the [`IndexNowServiceProvider`] is not registered.
pub async
/// The sources `indexnow:due` reads.
///
/// # Errors
///
/// Fails when the [`IndexNowServiceProvider`] is not registered.
pub async
/// Replace the transport with one that records what would have been submitted, and bypass the
/// queue. Assert on the returned [`Fake`].
///
/// The environment guard still applies: submissions only happen in the environments listed in
/// [`IndexNowConfig::environments`], `production` by default, and that includes faked ones. In the
/// `testing` environment nothing is recorded and every assertion fails, so allow it in your
/// test's configuration:
///
/// ```ignore
/// .with_config(|config, _| {
/// config.section_mut::<IndexNowConfig>().environments = vec!["testing".into()];
/// })
/// ```
///
/// # Errors
///
/// Fails when the [`IndexNowServiceProvider`] is not registered.
pub async